I have seen the template in the webmatrix but i want to create my own authentication system insead of using default one. please can anyone guide me how to do that?
The built in membership providers make life a lot easier for you, but if you want to roll your own authentication it's not too difficult. At a basic level, you just provide someone with a form that they can use to register, then save their details to a database.
When they log in, verify that there is a matching row on the database containing the the submitted user name and password, and set a session variable so that the site knows this person has validated.
If you want the person to remain logged in so they don't have to log in the next time they visit (Remember Me), set a cookie value.
Simple.
Oh, if your site requires it, you should encrypt the password in the database in case anyone else gets hold of a copy of it. And you should encrypt the cookie. And you might need to add a way for the user to get a password reminder, or to reset theirs in
case they have forgotten it. And you might want to email them a verification code so that you know the owner of the email address is who they say they are....
nikunj2512
Member
11 Points
14 Posts
Authentication Problem
Mar 12, 2011 02:26 PM|LINK
I have seen the template in the webmatrix but i want to create my own authentication system insead of using default one. please can anyone guide me how to do that?
XIII
All-Star
182707 Points
23464 Posts
ASPInsiders
Moderator
MVP
Re: Authentication Problem
Mar 12, 2011 02:38 PM|LINK
Hi,
and welcome to the ASP.NET forums.
There are quite a lot of tutorials already available under www.asp.net/webmatrix.
The one you're interested in is this one: http://www.asp.net/webmatrix/tutorials/16-adding-security-and-membership.
Grz, Kris.
Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
nikunj2512
Member
11 Points
14 Posts
Re: Authentication Problem
Mar 12, 2011 03:19 PM|LINK
Hi,
Thank You but i already read it but didn't get much help.
I made a table in which i define UserId, EmailAddress and Password. Can You tell me how to them using websecurity library for authentication?
Mikesdotnett...
All-Star
154951 Points
19870 Posts
Moderator
MVP
Re: Authentication Problem
Mar 12, 2011 03:42 PM|LINK
The built in membership providers make life a lot easier for you, but if you want to roll your own authentication it's not too difficult. At a basic level, you just provide someone with a form that they can use to register, then save their details to a database. When they log in, verify that there is a matching row on the database containing the the submitted user name and password, and set a session variable so that the site knows this person has validated.
If you want the person to remain logged in so they don't have to log in the next time they visit (Remember Me), set a cookie value.
Simple.
Oh, if your site requires it, you should encrypt the password in the database in case anyone else gets hold of a copy of it. And you should encrypt the cookie. And you might need to add a way for the user to get a password reminder, or to reset theirs in case they have forgotten it. And you might want to email them a verification code so that you know the owner of the email address is who they say they are....
Actually, there is an AccessMembershipProvider where the source code is available for you to see how these methods have been implemented. That should give you a head start: http://daron.yondem.com/PermaLink.aspx?guid=bad8a3cc-a19c-4cfb-9965-0225469c99b3
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter