简体   繁体   中英

Possible to authenticate/retrieve user on intranet when set to Forms authentication?

I have an asp.net MVC application that will be running on our company's intranet. I want to retrieve the logged on/windows identity of the user in lieu of a login page. Using Current.Request.LogonUserIdentity.Name and running on my local Visual Studio (ASP.Net Development Server), I am able to retrieve the user's domain/username. When published to my intranet webserver(IIS 7), I am only able to retrieve the username of the service my app pool is running under. Is it possible, using Forms authentication, for me to be able to retrieve the logged in user? Many of the discussions I have found suggest switching to Windows authentication...which is not an option for me at this point. My current authentication is forms:

<authentication mode="Forms">
  <forms loginUrl="~/User/Logon" timeout="2880" />
</authentication>`

my IIS has Anonymous, Impersonation, and Forms authentication enabled.

您是否尝试过Thread.CurrentPrincipal.Identity

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