Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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
C#-输入字符串中的LDAP身份验证格式不正确_C#_Authentication_Ldap - Fatal编程技术网

C#-输入字符串中的LDAP身份验证格式不正确

C#-输入字符串中的LDAP身份验证格式不正确,c#,authentication,ldap,C#,Authentication,Ldap,我正在尝试通过C#中的LDAP对用户进行身份验证。每次尝试登录时,都会出现“输入字符串格式不正确”错误 这是我的连接字符串: <connectionStrings> <add name="MyConnectionString" connectionString="LDAP://123.193.111.22:389.local" /> </connectionStrings> <system.web> <roleMana

我正在尝试通过C#中的LDAP对用户进行身份验证。每次尝试登录时,都会出现“输入字符串格式不正确”错误

这是我的连接字符串:

    <connectionStrings>
    <add name="MyConnectionString" connectionString="LDAP://123.193.111.22:389.local" />
</connectionStrings>
<system.web>
    <roleManager enabled="true" />
    <membership defaultProvider="MyMembershipProvider"><providers>
    <add name="MyMembershipProvider"
    connectionStringName="MyConnectionString"
    type="System.Web.Security.ActiveDirectoryMembershipProvider, 
    System.Web, Version=2.0.0.0, Culture=neutral, 
    PublicKeyToken=b03f5f7f11d50a3a"
    connectionUsername="MyUsername"
    connectionPassword="MyPassword" 
    connectionProtection="Secure"
    enableSearchMethods="true" />
    </providers>
    </membership>
    <trust level="Full" />
</system.web>
<authentication mode="Forms">
    <forms name=".ADAuthCookie" loginUrl="~/Admin/Login" 
    timeout="450" slidingExpiration="false" protection="All"/>
</authentication>


错误似乎在类型=“System.Web.Security.ActiveDirectoryMembershipProvider。如有任何建议,将不胜感激。谢谢

我已经设法弄明白了。必须修改会员资格提供商代码,现在我可以验证用户身份。

为什么要将
元素包装在
元素中?哦,对不起,我复制粘贴代码时一定是把它弄糟了。源代码中没有。您确定可以使用ldap://123.193.111.22:389.local这样的ldap url吗?您已经尝试过LDAP://123.193.111.22.local:389了吗?我已经尝试过了,不断出现“无法与服务器建立安全连接”错误。但这看起来像是另一个问题。。。