Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Team,

My Approach is of develop Unique product , where i want the Single URL of my application . Let's Say Eg: www.example.com . Now my requirement is Such that ,
the URL should remain Same , but I have different clients , Means Different databases for different clients. So please let me know how could i map to different databases for

for Different clients With Website URL . So please let me know how do i manage , or is there any IIS level Settings etc?
Posted

1 solution

You have to have one database for logins which will contain connection string to use for that particular client and redirect him further into the application. You have to take care to maintain the connection string in session, cookie or some other persistent way.

Possibly better design (depends on your particular setup, but for web it is almost always better) would be to simply have single database and qualify all relevant tables with clientID. That way data that is common to all (currencies, list of countries etc) can be common lookup tables and products and categories would be all in single table, but with clientID.
i.e.
TABLE products
    product_id int
    client_id int
    product_code
    product_name
    price
    discount


Then on login, you know which client is logged in and all queries will be filtered by client if it is relevant
SQL
SELECT * FROM products where client_id = @client_id



If this helps please take time to accept the solution.
 
Share this answer
 
v2
Comments
Pratik Bhuva 11-Dec-14 4:39am    
5ed :)
Nice Logic.
Sinisa Hajnal 11-Dec-14 4:52am    
Thank you. Works in practice for years on my countries biggest warehouse / transport firm. So, I'd say it is proven concept.

If you need something like that www.aktiva-info.hr :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900