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);
提前致谢