473,387 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Different connection strings based on user

I have a fairly large webapp which is used by many customers. Each customer has its own database.

I want to use the same webapp for all of the customers, but they still need to have separate databases and thus different connection strings.

What is the best way to do this?

I thought of this approach:
1. One database contains a table called Customers. This table contains all customers and what their connection string is.
2. When a customer is accessing the webapp, they should also provide their customerId (http://server/webapp/Default.aspx?customerid=xx)
3. Then i will retrive the connection String attributes from the Main database and will store in the session and its working finr.


But i think this is not a good solution. So can anyone suggest solution.

Thanks in advance.
Mar 16 '08 #1
2 1104
balabaster
797 Expert 512MB
I have a fairly large webapp which is used by many customers. Each customer has its own database.

I want to use the same webapp for all of the customers, but they still need to have separate databases and thus different connection strings.

What is the best way to do this?

I thought of this approach:
1. One database contains a table called Customers. This table contains all customers and what their connection string is.
2. When a customer is accessing the webapp, they should also provide their customerId (http://server/webapp/Default.aspx?customerid=xx)
3. Then i will retrive the connection String attributes from the Main database and will store in the session and its working finr.


But i think this is not a good solution. So can anyone suggest solution.

Thanks in advance.
I'm assuming that the database server is the same... i.e. they're all hooking up to the same instance of SQL Server (or some other server)? Or Microsoft Access? If that's the case, your customers table (which would be in a separate database) would only need to hold the name of the database or the filename of the access database. It does seem kind of hokey... but it's probably also the most secure.

In a commercial environment I would probably set a group username and password too in that table which they can save in a cookie so they don't have to enter it every time they connect - only the first time. This way is most likely the most secure because any given customer can't even get access to the connection string for another customer's database let alone any access to their data.
Mar 16 '08 #2
Also, take care if you are using the URL:
http://server/webapp/Default.aspx?customerid=xx

You will need to make sure that one customer cannot impersonate another customer by simply changing the customerid in the URL. This will need to happen on every page in the web app - not just the page after login.

I agree that the customer should provide a password as well as their id. If security of the database is also an issue, then consider encrypting the values in the table.

Good luck.
Mar 18 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Minh Tran | last post by:
In order to minimize the number of connection strings I have to use to access different databases on the same Sql Server, I was considering storing all stored procedures in just one database. I...
4
by: Mike Dole | last post by:
I'm working on a client - server application based on the 'How to Sockets Server and How to Sockets Client' code from the Visual Basic ..NET Resource Kit. Since I want to be able to send 'big...
3
by: Tim Marshall | last post by:
I'm starting to work with connection strings and Oracle. The connection string syntax is pretty much the same as MS SQL (based on one of Lyle's posts in response to a question I had about a jmonth...
4
by: Dan Walls | last post by:
Hi, I am deploying an ASP.Net web app into the following scenario: Internet --> Firewall --> WebServer (IIS) --> --> However I am not sure what sort of authentication options are available...
5
by: Matt | last post by:
Hello, What is the best way to handle the database connection string for a class library project that will be compiled and used as a .dll? This .dll will be accessed via classic ASP and in...
37
by: sam44 | last post by:
Hi, At startup the user log on and chooses the name of a client from a dropdownlist, which then changes dynamically the connection string (the name of the client indicates which database to use)....
1
by: CodeMonkey | last post by:
We have quite a few datasets that have been designed through the IDE. In our application, we generate a connection string to the server based on what the user configures the application for. The...
11
by: =?Utf-8?B?UGF0Qg==?= | last post by:
Is there a way in ASP.NET 2.0 to have different connection strings settings in a web.config files that are dynamically used based upon the server that the web application is running on? For...
2
by: Simon | last post by:
I have problems with connection strings. I have added new connection string to Web.config: <connectionStrings> <add name="ConnStr" connectionString="xxxxxxxxxxxxxxx"/> </connectionStrings> ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.