簡體   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