Two ASP.NET sites that use application files, but with different web.config

Is it possible to use virtual directories and / or virtual applications to configure two websites that use the same application code (aspx pages, etc.) but have different web.config files? Sites and code are located on the same server as on the same IIS.

I am using IIS 6.

+5
source share
5 answers

The short answer is no, if you want to save the code in one place. Probably the best solution is to download the custom configuration file application based on what you are defining for the site (presumably the site header?).

- ConfigurationManager.OpenExeConfiguration .

, , , , GetSection ( - ), , .

+5

.

???

Becuase asp.net , . web.config. - (IIS) root -.

.

+1

, , db -. , - , web.config , , ( . ).

, , , - , web.config. - .

+1

, web.config . , web.config

0

, A, B, C .., , , , web.config.

, - -, , DLL . GAC, .

IIS, ( ), , app_code.

RichardOD has the best answer above, and I have implemented something similar before. Basically, I set up my own configuration file, which is a link to web.config (to prevent the application from reloading when making changes to it). This file is read by the host name and contains specific properties for each node.

All I do is add host headers in IIS and an entry for that host in the user configuration file. Done.

0
source

All Articles