在 VS2010 中调试时执行此代码时如何显示 NTLM 和 Kerberos AuthenticationType:
IIdentity WinId = HttpContext.Current.User.Identity;
WindowsIdentity currentIdentity = WindowsIdentity.GetCurrent();
lblUserName.Text ="User NAme: " + WinId.Name;
lblIsAuthenticated.Text = "Is Authenticated: " + WinId.IsAuthenticated.ToString();
lbluthentiationType.Text = "Authetication type: " + WinId.AuthenticationType;
lblAuthenticationType2.Text = "Authentication Type: " + currentIdentity.AuthenticationType;
当我查看本地服务器时,它在 lblAuthenticatinType 和 lblAuthenticatinType2 上都显示协商
还
我只能在通过 IP (172.0.0.10:1111) 和 401.1 通过 servername:1111 和 servername.domain.com:1111 访问 Web 服务器时看到经过身份验证的用户
我不知道在哪里咬这个。我在 web.config 中启用了身份验证,如下所示
<authentication mode="Windows">
<!--<identity impersonate="true" userName="<domain>\<UserName>" password="<password>"/>-->
</authentication>
<authorization>
<!--<allow users="domain\user.name" /><allow roles="domain\Users" />-->
<allow users="?" />
</authorization>