Multiple instances one same web app

April 12th, 2012 - 02:54 pm ET by Cassio Tavares | Report spam
Hi everybody,

I have an app that is accessed by different companies. Each company
has a separate database but I want to have only one web app.

Today I have to create one web app to each company to use each
web.config to point to the right database. The user when logging in
selects the company id and each company has a folder/app copy with
it's own web.config.

Can I have only one web.app that has multiple web.config? Is this
correct or is it a bad practice? I was thinking if is possible to have
one bin folder and in someway point to a web.config that has the
configuration for the desired company.

I don't know if I made it clear enough, so tell me if you get it
right.

Thank you very much.
email Follow the discussionReplies 1 replyReplies Make a reply

Replies

#1 Brian Cryer
April 17th, 2012 - 05:37 am ET | Report spam
"Cassio Tavares" wrote in message
news:
Hi everybody,

I have an app that is accessed by different companies. Each company
has a separate database but I want to have only one web app.

Today I have to create one web app to each company to use each
web.config to point to the right database. The user when logging in
selects the company id and each company has a folder/app copy with
it's own web.config.

Can I have only one web.app that has multiple web.config? Is this
correct or is it a bad practice? I was thinking if is possible to have
one bin folder and in someway point to a web.config that has the
configuration for the desired company.



On the assumption that each company accesses your site via a different url
you can use the url to indicate the client and from there you can load the
configuration from a single common database. Since you would have one
application (and a single application pool) you would need to do this lookup
on each request. Sounds simple enough. I work with someone who does this as
a matter of course.

What you do need to do though is to move away from your configuration being
in the web.config file. There are sound reasons why it's not the brest place
to put your configuration - and you've just stumbled over one of them.
Brian Cryer
http://www.cryer.co.uk/brian

Similar topics