How do I return a string message from the ValidateUser method in my custom membership provider? I need this because I want to perform several checks (user is approved, user is blocked etc.) and give the user a good description, if the login process fails.
One option would be to throw an exception, but someone said that this is not a proper way for handling such situations.
For now I can only say "Login failed" or "Login succeeded" because of the bool return type.
Is it possible to create my own ValidateUser method or does the ASP.NET Membership mechanism uses the default one in it's internal operations?
Best Answer
Those are two different operations.
To see if a user is approved, locked out, etc., look up the user (with
GetUser()
) and look at theIsApproved
,IsLockedOut
, etc. properties of the returned user.ValidateUser()
is only for login, but you can do both.