Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 12, 2011 03:42 PM by Mikesdotnetting
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?
Mar 12, 2011 02:38 PM|LINK
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.
Mar 12, 2011 03:19 PM|LINK
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?
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.
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: