views:

251

answers:

1

I am using the following provider to look up users from ADAM. I would be able to like to change the connection string dynamically depending on the type of user. How can I achiev this?

<add name="con1" connectionString="LDAP://con1.url" />
<add name="con2" connectionString="LDAP://con2.url" />

  <providers>   


<add name="ConnectionProvider" connectionStringName="con1" type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" attributeMapUsername="userPrincipalName" enableSearchMethods="true" />


  </providers>

+1  A: 

You can get specific sections of the .config by using the ConfigurationManager.GetSection() method (System.Configuration namespace). From here, just apply the logic and select the connection string you want.

theG