views:

23

answers:

2

hey all,

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

+2  A: 

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);
Oskar Kjellin
Once you validate their username, you'll probably want to use FormsAuthentication.RedirectFromLoginPage( UserName, true/false ); to log them in.
Greg
+1  A: 

From http://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  
Greg