问题
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