简体   繁体   中英

ASP.NET 3.5 application with multiple web.config files (IIS 7)

We are working on a web application that creates more web applications.

Each web application will have to get a Url Rewrite rule (URL REWRITE MODULE 2.0).

As far as I know, there's no way to add such rules without modifying the web.config file (am I right??).

So my plan was to work with multiple web.config partial files. One main .config file, and lots of .config files per application (every file will contain it's web application url rewrite rules).

This way sounds a little bit messy, but I can't think of anything else, and suggestions will be welcomed.

So is it possible to use very-multiple web.config files for the root application?

Thanks in advance, Gal.

This following Tag will do the trick. The absence of this tag was the main reason for my problem when i using with two web.config files for my two different application running in my website.

**<location path="." inheritInChildApplications="false">**
   <system.web>
     <!-- ... -->
   </system.web>
**</location>**

Every application must have a full web.config and not partial, exept if you go with net 4

The trick is to use a lot the remove command on the other inside web.config and remove the parents setting that must not used on this.

For example if on the main root you have the a module that you do not won to use it on the other trees, you use the remove command on all other web.config to remove it. Especial the modules that are on one Bin and not on an other directory bin.

<httpModules>
  <remove name="TheHttoModuleNotNeedHere" />
  <remove name="AnonymousIdentification" />

  ... add here your other modules for that directory...
</httpModules>

The remove command is working for almost all sessions on config.

You can do make it work, I have done it, but its a lot of work to find all the conflicts/unnecessary configs and remove it.

For some other session there also the clear command. For example on role Manager you can clear all and add new.

<roleManager enabled="true" ...>
  <providers>
    <clear />
    <add name="MyName" ... type="System.Web.Security.SqlRoleProvider" />
  </providers>

Hope this help as tips to make it work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM