Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 connect to the correct DB

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2010-02-17 : 07:23:49
Hello,
I have developed a website with database for a business... The connection strings to the database are inside the web.config file.
Now I would like to have the same website to be able to use another database
So each business has it's own database and they all use the same website...
The website at present is using the login controls in asp.net to login to the system...
what is the best way to make sure when someone from a particular business is using the website then he is pointed to his business database and not another?

I am thinking may be the best thing is to have one unique login page for each business.
Any thoughts please?
thanks

manassahu.it
Starting Member

2 Posts

Posted - 2010-02-17 : 07:49:09
I must have a Businessid or any id which identify the business uniquly.

Declare multible connection string in web.config file and select the connection string on
the basis of business id.



My Blog : http://expertdevelopersblog.blogspot.com/
Manas Ranjan Sahu
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2010-02-17 : 08:05:25
Do you mean like having several connectionstrings in the webconfig (One for each database), and then have a drop down on the first page which the user can select the database. Then they login to the database and if they have a login then they get in otherwise they do not get in, right?
Go to Top of Page

MrQuizzles
Starting Member

20 Posts

Posted - 2010-02-17 : 15:27:21
The best way in my eyes would be to have the login determine which database is pointed to. Encapsulate it. Make it as invisible to the users, as they should not be aware of anything that's going on underneath the interface.
Go to Top of Page
   

- Advertisement -