With ASP.Net membership, can multiple membership providers be used to access the same site?

The situation is as follows:

We have several (19) sites that are currently configured to share a single ASP Membership database using different application names, such as:

<membership defaultProvider="Site1Membership">
  <providers>
    <add
      applicationName="/site1"
      name="Site1Membership" />
    <add
      applicationName="/site2"
      name="Site2Membership" />
  </providers>
</membership>

My question is, are there several providers defined in web.config, can a user log in via a different provider than the default?

In this configuration, it is obvious that the user stored at the default provider with the application name "/ site1" will be able to log in, but we would like the user in the repository with the application name "/ site2" to also be able to log in.

, , :

site2: 2Membership:

.

, , , 19 (.. 1 2), 20- , , /.

+3
1

, - . , , : "" . , - "G" "MyCompany", .

. Click OnAuthenticate LoginControl .

MembershipProvider provider;
if ( username.Text.StartsWith("G\") then
    provider = Membership.Providers["GlobalProvider"];
else
    provider = Membership.Providers["StandardProvider"];

if ( provider.ValidateUser( ... 

, , . SqlRoleProvider . , SqlRoleProvider, MemberhipProvider , RoleProvider. , , - .

+4

Source: https://habr.com/ru/post/1759378/


All Articles