0

I´m trying to authenticate users in ASP .Net MVC with ldap, but it isn´t working. I´m running wireshark to see if IIS is at least connecting to the LDAP server, but it´s not connecting.

I have an SQL database for the web, and then I want to authenticate users with a LDAP server.

Here is my Web.config:

<configuration>
  <connectionStrings>
    <add name="ADConnectionString" connectionString="LDAP://IP:PORT/OU=...,DC=..."/>
    <add name="MySqlMembershipConnection"
          connectionString="Pipe=MySQL;
                            Protocol=pipe;
                            Server=localhost;
                            Database=My DB;
                            User Id=My User;
                            Password=My Password;
                            "
          providerName="MySql.Data.MySqlClient"/>
  </connectionStrings>

  <appSettings>
    <add key="webpages:Version" value="1.0.0.0" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>

  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
    </compilation>

    <membership>
      <providers>
        <clear/>
        <add name="MySqlMembershipProvider"
             type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, 
                 Version=6.6.4.0, Culture=neutral, 
                 PublicKeyToken=c5687fc88969c44d"
             connectionStringName="MySqlMembershipConnection"
             enablePasswordRetrieval="false"
             enablePasswordReset="true"
             requiresQuestionAndAnswer="false"
             requiresUniqueEmail="true"
             passwordFormat="Hashed"
             maxInvalidPasswordAttempts="5"
             minRequiredPasswordLength="6"
             minRequiredNonalphanumericCharacters="0"
             passwordAttemptWindow="10"
             applicationName="/"
             autogenerateschema="true"/>

        <add name="ADMembership"
             type="System.Web.Security.ActiveDirectoryMembershipProvider,
               System.Web,
               Version=2.0.0.0, 
               Culture=neutral,
               PublicToken=b03f5f7f11d50a3a"
             connectionStringName="ADConnectionString"
             connectionUsername="LDAP User name"
             connectionPassword="LDAP Password" />
      </providers>
    </membership>

    <authentication mode="Windows" />

    <authorization>
      <deny users="?" />
    </authorization>

    <profile>
      <providers>
        <clear/>
        <add type="MySql.Web.Security.MySQLProfileProvider, MySql.Web, 
                 Version=6.6.4.0, Culture=neutral, 
                 PublicKeyToken=c5687fc88969c44d"
             name="MySqlProfileProvider"
             applicationName="/"
             connectionStringName="MySqlMembershipConnection"
             autogenerateschema="true"/>
      </providers>
    </profile>

    <roleManager enabled="true" defaultProvider="MySqlRoleProvider">
      <providers>
        <clear />
        <add connectionStringName="MySqlMembershipConnection"
             applicationName="/"
             name="MySqlRoleProvider"
             type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, 
                 Version=6.6.4.0, Culture=neutral, 
                 PublicKeyToken=c5687fc88969c44d"
             autogenerateschema="true"/>
      </providers>
    </roleManager>

    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages"/>
      </namespaces>
    </pages>
  </system.web>

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>
4

0 回答 0