Search code examples
c#asp.net-membershipmembership-provider

Custom ValidateUser() in custom .net MembershipProvider


Is there a way to extend the ValidateUser method to receive other parameters than the default?

Default

public override bool ValidateUser(string username, string password)
{
    return db.ValidateUser(username, password);
}

I'd like to implement

public bool ValidateUser(Guid rsid)
{
    return db.ValidateUser(rsid);
}

'db' is a class containing methods to communicate with the database(s). This is not my design any way, it's a customer who wants to be able to sign in with Guid links, safe ey! :)

Thanks


Solution

  • How about just passing a string representation of a Guid in and converting?

    public override bool ValidateUser(string username, string password)
    {
        Guid rsid;
    
        if (Guid.TryParse(username, out rsid))
        {
            return db.ValidateUser(rsid);
        }
        else
        {
            return false;
        }
    }