What is the purpose of Membership.ValidateUser()

喜夏-厌秋 提交于 2020-01-02 03:12:25

问题


I've been learning about the MembershipProvider class and I thought that the Membership.ValidateUser() method was supposed to be used to to log a user in.

However, I just learned that there is a FormsAuthentication.Authenticate().

What is the purpose of ValidateUser() within Membership?


回答1:


In short, there are times when you might want to simply validate that a user is who they say they are without needing to persist an authentication cookie for any length of time.




回答2:


It only check your data source (database) if the passed username and password exist in the database and match and returns true Check MSDN. If they don't match, it returns false

public static bool ValidateUser(string username, string password)


来源:https://stackoverflow.com/questions/12095700/what-is-the-purpose-of-membership-validateuser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!