简体   繁体   中英

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

I want to get windows login username in asp.net with single sign on

I use Global.asax Session_Start I tried WindowsIdentity.GetCurrent(); İt is working in local but it is not working in IIS. In local DomainName//UserName but in IIS IISAPPPOOL\\AppName

In IIS Authenthentication => Anonymous Authenthentication is enabled, ASP.NET Impersonation is disabled, Forms Authentication is disabled also when ı change them application is not working.

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

How can ı solve this

Just disable anonymous authentication and enable windows authentication. Windows authentication may not be installed. If so, it will not work in any way. Go to server roles on Windows Server or windows features on Windows 7 / 8: complete manual .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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