简体   繁体   English

使用身份验证模式=“ forms”在Intranet中获取域\\用户

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

I have to install a ASP.NET site in a intranet network. 我必须在Intranet网络中安装一个ASP.NET站点。 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 我关注了这篇文章: http : //support.microsoft.com/kb/306359

But it doesn't work. 但这是行不通的。 My web.config has: 我的web.config具有:

 <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 我正在使用IIS 6和.net 4在IIS的身份验证方法设置中,我已经检查了

-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). 如果启用了匿名访问,则网站访问者都将模拟IUSR_MachineName帐户(或任何您配置为匿名帐户的帐户)。

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. 您需要禁用匿名访问,以便该站点将强制用户使用其凭据进行身份验证,以便它们在您的ASP.NET页中可用。 Otherwise the server has no idea who the current user is. 否则,服务器不知道当前用户是谁。

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

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