Pergunta

I have a website that is already built using the default aspnet membership provider. I am looking to expand it in order to slightly modify the functions.

From my understanding, I would want to create a custom membership provider inheriting from the membership class, and then overload the functions. I got that far, but I was unable to figure out how to call the original validate user.

My goal was to change the validate user to something like...

public override bool ValidateUser(string userName, string password)
    {
        if(base.ValidateUser(userName, password))
        {
          \\Write to database that User logged in
          return true;
        }
        return false;
    }

However, when I tried that, base.ValidateUser(x,y) threw errors. How would I go about achieving what I want to?

Foi útil?

Solução

My guess is that you have inherited from the abstract MembershipProvider class. If this is so then calling the base class method is of course impossible as there is no implementation in the abstract class.

If, on the other hand, you want to call a base class method, you have to inherit from proper base class, like the SqlMembershipProvider.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top