2013-04-10 63 views
2

NET应用程序使用Windows身份验证 应用程序在我的本地解决方案中正常工作。但是在IIS中托管时,它要求用户访问托管服务器。它不会从客户端计算机获取用户凭据。ASP.NET应用程序中的Windows身份验证在IIS中托管后无法正常工作

下面是我的web.config

<authentication mode="Windows"> 
     <!--<forms loginUrl="~/Account/Login.aspx" timeout="2880" />--> 
</authentication> 
<identity impersonate="false" /> 
<membership> 
    <providers> 
    <clear/> 
    <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" 
     enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" 
     maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" 
     applicationName="/" /> 
    </providers> 
</membership> 

<profile> 
    <providers> 
    <clear/> 
    <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/> 
    </providers> 
</profile> 

<roleManager enabled="false"> 
    <providers> 
    <clear/> 
    <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" /> 
    <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" /> 
    </providers> 
</roleManager> 

<httpRuntime maxRequestLength="102400" /> 

和ASP代码背后得到的用户名是如下

string currentUser = HttpContext.Current.User.Identity.Name.ToLower(); 
       currentUser = currentUser.Replace("kmhp\\", ""); 
       SessionManager.Session.Current.LoggedInUserName = currentUser; 
       dsValidateLogin = _grantAccessHandler.ValidateLogin(currentUser); 

在此先感谢

回答

-1

很可能您需要拥有客户端凭据。就拿下面

<wsHttpBinding> 
<binding name="TransportSecurity"> 
<security mode="Transport" /> 
    <transport clientCredentialType = "Windows" /> 
</security> 

看看参考:HttpBinding

0

这可能是一个客户端配置问题。使用Internet Explorer时,您必须确保客户端将IIS服务器识别为Intranet区域的一部分。默认情况下,只有Intranet区域允许输入用户凭证。 IE有一些自动检测机制,但并不总是有效。对于Firefox,您需要在about:config中将您的IIS服务器主机名添加到配置值“network.automatic-ntlm-auth.trusted-uris”中。否则,Firefox也不会将凭证转发给您的服务器。

相关问题