Another way around is to add a new method in the MembershipProvider (outside the defined interface), for example:
public class CustomMembershipProvider : MembershipProvider {
private LoginValidationType ValidationType;
// new method
public bool ValidateUser(string username, string password, LoginValidationType validationType = LoginValidationType.WebsiteSpecific) {
ValidationType = validationType;
return ValidateUser(username, password);
}
// the original method
public override bool ValidateUser(string username, string password) {
// do stuff with username, password and this.ValidationType
}
In your calling code you can now do:
CustomMembershipProvider provider = new CustomMembershipProvider();
// original method
provider.ValidateUser("un", "pass");
// or call our new overload
provider.ValidateUser("un", "pass", LoginValidationType.WebsiteSpecific);
Instead of:
Membership.ValidateUser("un", "pass");
But it still feels hacky. Just adding the new public method does not result in the default Membership class showing the method, and I don't know if it can be changed to do this anyway.
At least you don't have to abuse datatypes this way and have methods for specific situations.