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);
在此先感謝