Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 是否将windows身份验证与Active directory轻型目录服务一起使用?_Asp.net_Adlds - Fatal编程技术网

Asp.net 是否将windows身份验证与Active directory轻型目录服务一起使用?

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"> <

我正在尝试在ASP.net应用程序中使用AD轻型目录服务进行用户身份验证,但不想使用表单身份验证。是否有任何方法可以使用windows身份验证对其进行身份验证

<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;
...