Question

I'm using Form Authentication and Membership provider. When I call Membership.ValidateUser(logon.UserName,logon.Password), it's only returning a boolean which indicates whether this user is valid. But I want the User to be returned. How can I do that?

Était-ce utile?

La solution

        string userName = "someuser";
        string password = "";
        MembershipUser user = null;
        if (Membership.ValidateUser(userName,password))
        {
            user = Membership.GetUser(userName);
        }
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top