2013-04-10 58 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也不會將憑證轉發給您的服務器。

相關問題