开发者

ASP.net Membership control

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 pas开发者_运维问答sword in the database is obviously hashed !!

thanks


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);


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  
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜