Reputation: 4334
iv used the built in membership control for my ASP.net project, this create the database and everything for me, but say i didnt want to use the built in login control, and i wanted to make my own login. how would check the password enetered by the user is the same as the password in the database for that user ?? because the password in the database is obviously hashed !!
thanks
Upvotes: 0
Views: 59
Reputation: 16680
From https://web.archive.org/web/20210513002246/https://www.4guysfromrolla.com/webtech/110701-1.3.shtml
If FormsAuthentication.Authenticate (txtUserName.Text, txtPassword.Text) Then
FormsAuthentication.RedirectFromLoginPage (UserName.Text, chkPersistCookie.Checked)
Else
'Invalid credentials supplied, display message'
lblMessage.Text = "Invalid login credentials"
End If
Upvotes: 1
Reputation: 21880
Hey, check out this link: http://msdn.microsoft.com/en-us/library/system.web.security.membership.validateuser.aspx
Does exactly what you want. You write the code like this:
bool valid = Membership.ValidateUser(Username, Password);
Upvotes: 2