With ASP.Net Membership, can a multiple Membership providers be used for login to the same website?

It is possible to do however you have to write some custom code. In short, you need a way of determine to which group of users the given login belongs: an app specific user or a "global" user. I have handled this by requiring global users prefix their login with something like "G\" or "MyCompany\" whereas normal users are not required to do this The authentication aspect is actually quite easy.In the Click event of your login button or the OnAuthenticate method of the LoginControl, you simply need to detect the user and match them to the correct membership provider name MembershipProvider provider; if ( username.Text.

StartsWith("G\") then provider = Membership. Providers"GlobalProvider"; else provider = Membership. Providers"StandardProvider"; if ( provider.

ValidateUser( Where it gets complicated is the roles. The SqlRoleProvider is not designed to handle multiple applications using the same user store. You have to alter the procedures used by the SqlRoleProvider so that it will honor the application of the MembershipProvider instead of its default nature which is to only use the application of the RoleProvider.

In addition, you'll need to ensure that the global users are automatically added to some role when they login.

It is possible to do however you have to write some custom code. In short, you need a way of determine to which group of users the given login belongs: an app specific user or a "global" user. I have handled this by requiring global users prefix their login with something like "G\" or "MyCompany\" whereas normal users are not required to do this.

The authentication aspect is actually quite easy. In the Click event of your login button or the OnAuthenticate method of the LoginControl, you simply need to detect the user and match them to the correct membership provider name. MembershipProvider provider; if ( username.Text.

StartsWith("G\") then provider = Membership. Providers"GlobalProvider"; else provider = Membership. Providers"StandardProvider"; if ( provider.

ValidateUser( ... Where it gets complicated is the roles. The SqlRoleProvider is not designed to handle multiple applications using the same user store. You have to alter the procedures used by the SqlRoleProvider so that it will honor the application of the MembershipProvider instead of its default nature which is to only use the application of the RoleProvider.In addition, you'll need to ensure that the global users are automatically added to some role when they login.

We were hoping to avoid code or writing a custom provider, but it looks like that's the answer. :( – Ragoczy Aug 26 '10 at 14:32.

In short, you need a way of determine to which group of users the given login belongs: an app specific user or a "global" user. I have handled this by requiring global users prefix their login with something like "G\" or "MyCompany\" whereas normal users are not required to do this. The authentication aspect is actually quite easy.

In the Click event of your login button or the OnAuthenticate method of the LoginControl, you simply need to detect the user and match them to the correct membership provider name. Where it gets complicated is the roles. The SqlRoleProvider is not designed to handle multiple applications using the same user store.

You have to alter the procedures used by the SqlRoleProvider so that it will honor the application of the MembershipProvider instead of its default nature which is to only use the application of the RoleProvider. In addition, you'll need to ensure that the global users are automatically added to some role when they login.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions