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?

有帮助吗?

解决方案

        string userName = "someuser";
        string password = "";
        MembershipUser user = null;
        if (Membership.ValidateUser(userName,password))
        {
            user = Membership.GetUser(userName);
        }
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top