Asp.net 是否将windows身份验证与Active directory轻型目录服务一起使用?
我正在尝试在ASP.net应用程序中使用AD轻型目录服务进行用户身份验证,但不想使用表单身份验证。是否有任何方法可以使用windows身份验证对其进行身份验证Asp.net 是否将windows身份验证与Active directory轻型目录服务一起使用?,asp.net,adlds,Asp.net,Adlds,我正在尝试在ASP.net应用程序中使用AD轻型目录服务进行用户身份验证,但不想使用表单身份验证。是否有任何方法可以使用windows身份验证对其进行身份验证 <authentication mode="Windows" /> 您可以试试这个 编辑: 这对我很有用: <!-- web.config --> ... <system.web> ... <compilation debug="true"> <
<authentication mode="Windows" />
您可以试试这个
编辑:
这对我很有用:
<!-- web.config -->
...
<system.web>
...
<compilation debug="true">
<assemblies>
<add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
</assemblies>
</compilation>
<authentication mode="Windows"/>
<identity impersonate="true"/>
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
<roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider"/>
<authorization>
<deny users="?"/>
<allow users="*"/>
</authorization>
</system.web>
...
您应该能够使用一些自定义代码,例如。在这里你可以找到更多关于 我想使用AD LDS对用户进行身份验证,但不想使用表单身份验证。@AshokD:我添加了一个示例
//page.cs
...
string userName = HttpContext.Current.User.Identity.Name;
...