1

I have to create a site that uses the active directory from another server to auth the user. First my page should try to auth the user automatically with his windows login and if this haven´t success it should ask him with a form for username/pw.

This is what i have so far in my Web.config, just a few code snippets. The web wasen´t as helpful as i hoped :-(

<connectionStrings>
  <add name="ADConnectionString" connectionString="LDAP://testdomain.test.com/CN=Users,DC=testdomain,DC=test,DC=com" />
</connectionStrings>

<membership defaultProvider="MyADMembershipProvider">
  <providers>
    <add
       name="MyADMembershipProvider"
       type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
       connectionStringName="ADConnectionString"
       connectionUsername="testdomain\administrator"
       connectionPassword="password"/>
  </providers>
</membership>

<system.web>

  <authentication mode="Windows" />

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

</system.web>
jwillmer
  • 3,570
  • 5
  • 37
  • 73
  • If a user is not in AD, what membership provider is used? You also should consider your RoleManager as well, since the same issues regarding multiple providers will apply to roles. – counsellorben Oct 20 '11 at 16:31

1 Answers1

1

There is a very good article on mixing two authentication schemes here. Also see related question here

Community
  • 1
  • 1
Emmanuel N
  • 7,350
  • 2
  • 26
  • 36