这是我用于 Windows 身份验证设置的 Web.Config 的摘录。
<authentication mode="Windows" />
<identity impersonate="true" />
<roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider" />
<authorization>
<!-- The following roles are group memberships in Active Directory. -->
<allow roles="domain\finance,domain\it" />
<deny users="*" />
</authorization>
我使用 .net 4.0 经典管道模式:经典
在 IIS 中,我应用了以下身份验证设置:
Anonymous Autehntication: Disabled
ASP.Net Impersonation: Enabled
Basic Authentication: Disabled
Digest Authetication: Disabled
Forms Authetication: Disabled
Windows Authentication: Enabled
从角色(AD 组)中的用户帐户访问页面时,我会看到一个用户名/密码窗口:(
这是整个 web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="it@domain.com">
<network host="10.0.0.150" port="25" />
</smtp>
</mailSettings>
</system.net>
<system.web>
<compilation targetFramework="4.0" />
<customErrors mode="Off" />
<authentication mode="Windows" />
<identity impersonate="true" />
<roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider" />
<authorization>
<allow roles="domain\finance,domain\it" />
</authorization>
</system.web>
</configuration>