将用户设置为Authenticated ASP.NET MVC

时间:2016-04-05 14:12:05

标签: c# asp.net-mvc active-directory asp.net-identity membership

我在MVC中遇到AD身份验证问题。在我的控制器中,我有以下内容:

public static SignInStatus Login(string userid, string password) {
        // Attempt to login using the supplied credentials
        SignInStatus result = IsAuthenticated(@"LDAP://myladapserver", userid, password);

        if (result == SignInStatus.Success)
        {
           // What do I put here, so that when I call User.Identity.IsAuthenticated I get true??

        }
        return result;
    }

我的问题是,在从AD获得成功回复之后,我如何实际登录用户,这样当我调用User.Identity.IsAuthenticated时,我得到了正确的回复?

BTW IsAuthenticated()调用只是根据AD验证用户ID和密码。

0 个答案:

没有答案