By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,560 Members | 1,338 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,560 IT Pros & Developers. It's quick & easy.

How to specify a "backup server" for ActiveDirectory Membership Provider

P: 32

The question:
Is it possible to have two differents ActiveDirectory Membership Provider in web.config and change at run-time from the default provider to the second provider if the first one fail?

We are using the ActiveDirectory Membership Provider as part of our authentication solution. It is working great most of the time, but every now and then the AD process on the main server fail.

With Windows this is not a problem as the authentication is done by the domain and whichever of our two AD servers is up process the request.

In the web.config file however, I think that we must specify which server to use :
<add name="ADConnectionString" connectionString="LDAP://,DC=CORP,DC=DOMAIN,DC=COM"/>

With this kind of connection string, if the AD process on server01 fails, we are screwed.

I tried to add a second ADMembershipProvider roughly like this in web.config:

<membership defaultProvider="MyADMembershipProvider">
<add name="MyADMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershi pProvider .... connectionStringName="ADConnectionString01"/>
<add name="MyADMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershi pProvider .... connectionStringName="ADConnectionString01"/>

With that, I thought that I could put the authentication code inside a Try / Catch and if the first provider fail then use the second one but it didn't work. The errors I get when doing this makes me think that the compiler consider one and only one ADMembership provider.

Does anyone know a way I could switch from server01 to server02? Or could I write the connection string without explicitly specifing which server to use (let's say: add name="ADConnectionString" connectionString="LDAP://DC=SUB,DC=CORP,DC=DOMAIN,DC=COM") ?

Thank you very much!!
Jun 8 '09 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.