AspNet Membership - Login Centralization

Now we have several databases, each separate database has its own aspnet membership tables. We want to centralize all membership in one database. For example, the main login page, where they will indicate the database, username and password. Then we will check the centralized database and authenticate and redirect them to our account based on the database name that they entered in the text box.

What is the best way to do this? Perhaps several different usernames are the same in different databases, and this is my task.

+4
source share
4 answers

Membership in ASP.Net has an Application Table . As long as you have a different application name for another website, you can combine them into one large database; the likelihood of duplication of the user ID (which is stored as uniqueid) is very small.

When a user logs in, you will need the following 3 fields -

  • Application (it could be DropDownLis)
  • Username
  • Password

Create your own check

You cannot use your own membership provider to verify a user who accepts only a username and password.

// ValidateUser method doesn't take any additional parameter public bool ValidateUser(string username, string password) 

So, you need to implement your own verification method to validate a user from a federated database.

Note

If you are redirected to another website, please note the limitation on the authenticity of the form. For example, it cannot transfer authentication cookies from www.one.com to www.two.com

+2
source

Can we assume that "user123" in database1 and "user123" in database2 are the same person?

If so, you can simply come together as DJ KRAZE suggested. If not, you will need to create new users for duplicate usernames. You can write a fairly simple SQL script to do this by adding a number to the end of the identifier.

As .... found "john" in database 1, create the user "john1". As far as I remember, the aspnet_membership database comes with a fairly reliable set of stored procedures for creating users, etc., which create all the necessary records in the table. I would definitely use them, instead of trying to follow the freestyle insert / update instructions if you finish this route

0
source

I believe that you can choose a database to connect to your account. therefore, create a drop-down list where users can select the database to connect, and then use this selection as the database. take a look at number 4 at http://forums.asp.net/t/1403132.aspx/1 the choice may be the name connectionstring, which indicates the database.

0
source

Based on my experience, the best thing you can do is prefix user names based on the original duplicate database and delegate consolidation to the end user.

0
source

All Articles