简体   繁体   中英

Get domain\user in a intranet using authentication mode = “forms”

I have to install a ASP.NET site in a intranet network. I'm using a authentication mode=Forms". In a my page i need to get the domain\\user of the user connected.

I've followed this article: http://support.microsoft.com/kb/306359

But it doesn't work. My web.config has:

 <identity impersonate="true"/>
<authentication mode="Forms" >
          <forms name="login" loginUrl="~/Login.aspx" defaultUrl="~/Default.aspx" timeout="30000" />
</authentication>  
<authorization>      
  <deny users = "?" />
  <!-- This denies access to the Anonymous user -->
  <allow users ="*" />
  <!-- This allows access to all users -->
</authorization>

I'm using IIS 6 and .net 4 In Authentication methods settings of iis i've checked

-Enable anonymous access
-Integrated windows authentication

How can i do?

thanks

If you have anonymous access enabled the web-site visitors will all be impersonating the IUSR_MachineName account (or whatever you have configured as the anonymous account).

You need to disable anonymous access so the site will force the user to authenticate with his/her credentials so they will be available in your ASP.NET page. Otherwise the server has no idea who the current user is.

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