I have the following :-
My current situation is as follow:-
So my question is :-
You need to add 2 sets of <providers>
in your web.config, 1 for each domain, as follows.
1) In the Web.config
file, add connection strings similar to those shown in the following example that point to your Active Directory user database for each domain.
<connectionStrings>
<add name="TestDomain1ConnectionString" connectionString="LDAP://testdomain1.test.com/CN=Users,DC=testdomain1,DC=test,DC=com" />
<add name="TestDomain2ConnectionString" connectionString="LDAP://testdomain2.test.com/CN=Users,DC=testdomain2,DC=test,DC=com" />
.
..
...
</connectionStrings>
2) In the Web.config
file, configure the <membership>
element with ActiveDirectoryMembershipProvider instances pointing to each domain as shown here.
<membership >
<providers>
<add
name="TestDomain1ADMembershipProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="TestDomain1ConnectionString"
connectionUsername="testdomain1\administrator"
connectionPassword="password"/>
<add
name="TestDomain2ADMembershipProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="TestDomain2ConnectionString"
connectionUsername="testdomain2\administrator"
connectionPassword="password"/>
</providers>
</membership>
Make sure you set the connectionStringName
attribute to the correct connection string name specified earlier in your <connectionStrings>
section.
For detailed walkthrough of setting this up and making sure it works, see here.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.