繁体   English   中英

如何通过单点登录在asp.net中获取Windows登录用户名

[英]How to get windows login username in asp.net with single sign on

我想通过单点登录在asp.net中获得Windows登录用户名

我使用Global.asax Session_Start我尝试了WindowsIdentity.GetCurrent(); 它在本地工作,但在IIS中不工作。 在本地DomainName // UserName中,但在IIS中IISAPPPOOL \\ AppName

在IIS身份验证=>中启用了匿名身份验证,禁用了ASP.NET模拟,并且在更改它们的应用程序不起作用时,也禁用了表单身份验证。

My web config is like this
 <authentication mode="Windows">
    </authentication>
    <authorization>
      <deny users="?" />
    </authorization>
<identity impersonate="true" />

Thread.CurrentPrincipal.Identity.Name; is null
HttpContext.Current.Request.LogonUserIdentity.Name; is IIS IISAPPPOOL\AppName 
 Context.User.Identity.Name; is null
System.Security.Principal.WindowsPrincipal p = System.Threading.Thread.CurrentPrincipal as System.Security.Principal.WindowsPrincipal; is null
HttpContext.Current.User.Identity.Name; is null

我该怎么解决

只需禁用匿名身份验证并启用Windows身份验证即可。 Windows身份验证可能未安装。 如果是这样,它将无法以任何方式工作。 转到Windows Server上的服务器角色或Windows 7/8上的Windows功能: 完整手册

我解决了:)只需使用组策略首选项注册表配置IE可信站点http://deployhappiness.com/managing-internet-explorer-trusted-sites-with-group-policy/谢谢

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM