views:

1542

answers:

3

I know that there at least two approaches to leverage the web.config file:

Now, my problem is that both approaches work well only for physical paths. But I need to address a config file which is in a virtual directory.

Which other method could I use to put my config resources in a virtual directory?

Note: I want to do it this way, because I have multiple instances of my web application on the same server (and that on many servers). To keep deployment easy and clean, I want to keep one directory for all the files (aspx, ascx, images, css, js etc.) and point the web apps in IIS for different customers (=domains, https etc.) to this single directory. In every IIS web I would have a virtual directory called "custom" which points to a different folder for each web.

Update: I'd like to point out that this virtual directory "custom" is not suited to contain an inherited web.config - that web.config would be valid only for the custom folder which doesn't contain aspx/ascx files.

+1  A: 

Virtual Directories can be set as applications, and you can just place another web.config there.

It will inherit any changes from the parent config, and you can add custom settings in it.

FlySwat
Unfortunately this is not an option, because the application is not in the "custom" virtual directory. I will update my question to make that point clear.
splattne
+1  A: 

I was looking to do the same thing but it did not work, so I decided to do the opposite, as you know the web.config can be inherited, so I pointed IIS to a folder containing the client config (connection string, file path etc) files and the website files i put them on a virtual directory with the rest of the webconfig (where it load dll and other application files needed) So basically i can use the website files to multple clients and the clients with their own Database connection string and other specific client settings.