January 29, 2012 at 11:21 pm
down vote favorite
share [g+] share [fb] share [tw]
I have multiple databases say DB1, DB2, DB3 and MembershipDB. Every Database has GUID column named ApplicationID & set of Users having MembershipID as GUID. Each User of every Database is Isolated (have no relationship) with User of other Database. Membership Database contains the Users MembershipID and Database’s ApplicationID , password, username, email etc.
I need to create a common login system like When a user provides his login credential authentication is to be done from MembershipDB and his data is to be fetched from the database he is registered to.
Eg: a user from DB1 provides his login details, authentication is done from membershipDB. Now rest of his data is to be fetched from DB1(as he is registered to DB1) to his dashboard. I am bit confuse how to build this login system.
Authentication part is no problem. But how to connect to the correct DB to get the correct data for the user.
All the valuable comments and suggestions are welcome.
I am using Microsoft SQL SERVER 2008, Entity Framework 4.2 (database ist approach), WCF, asp.net MVC 4
January 30, 2012 at 9:36 am
Off the top of my head I'd handle this in the .NET application by having a connection for the membershipDB and then a connection for the application DB. The connection for the application DB would have it's connection string set dynamically by returning the the allowed database when authenticating using the memebership database.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
January 30, 2012 at 9:42 am
I agree with Jack. Just create your user object and populate on successful login and toss the User object into the session (then there is no need to query it again). Then either have a connection string for each database or have the database name as part of your User object. That way you can have the data connection string in your User object or you can use the User object to build your string.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply