In my Custom member ship provider I have provided implementation for the ValidateUser and things were fine so far but now suddenly PasswordFormat have started throwing
NotImplementedException was unhandled by user code
There is no change in my web.config or Custom Membership. Some of the stack overflow answers referring to add the role manager under system.web in Web.config but it didn't work for me. Also, I have tried the answer suggested by Josh here but still no difference. I am using Hexa decimal encoding.
None of the other apart from ValidateUser is implemented in my custom membership, which is as follow
public override bool ValidateUser(string username, string password)
{
LoginModel model = new LoginModel
{
UserName = username,
Password = password,
ErrorMessage = ""
};
User user = UserManager.AuthenticateUser(model);
if (user != null)
{
HttpContext.Current.Items.Add("User", user);
return true;
}
return false;
}
Sharing my solution here in case if someone else needs it.
PasswordFormat value can be defined in web config and then provide implementation by reading its value in the PasswordFormat of MembershipPasswordFormat as explained here.
If someone don't want to set the value in web.config, it can also be set in the Membership Password Format as membership stuff hardly every changes during the life time of an application.