Posts Tagged asp.net

Stop the “web.config” being inherited by child applications in sub folders

We recently had an issue setting a .net microsite live off the back of an existing domain, hosting another .net site.

This was due to the web.config being inherited to the child- we would be hit with errors like this;

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not load file or assembly ‘UrlRewritingNet.UrlRewriter’ or one of its dependencies. The system cannot find the file specified. (d:ProjectsVSAspDotNetFaqProjectWebsiteweb.config line 89)

Source Error:

Line 88: <httpModules>
Line 89:   <add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, 
      UrlRewritingNet.UrlRewriter"/>
Line 90:   <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, 
          System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Line 91: </httpModules>

This is because a module was defined in the parent site which doesn’t exist in the child, but because it’s inheriting it still tries to load it.  We would also get errors complaining that modules have already been defined.

I tried initially, manually adding <remove name=”blah” /> to the child web.config to remove the entries in the child web.config it thought were defined twice, but after putting in about 10 of these and it still not working it started to get a bit ridiculous!

The trick, we found on google (How to disable web.config Inheritance for Child Applications in Subfolders in ASP.NET?) is to stop the web.config from inheriting in the top level web.config;

<location path=. inheritInChildApplications=false>

<system.web>

</system.web>
<
/location>

This stops anything being migrated down to the children, allowing you to have your full web.config in the child site, unaffected by the parent! — Make sure you don’t put this around anything else though; just the system.web section!

, ,

No Comments

I absolutely love these. They came at the lace wigs are good quality, and very soft. Absolutely love these extensions. I just love this hair. Hair came on time, I waited until after hair extensions uk very full, no shedding and it is been installed for 3 weeks now and yes I jus ordered 3 more bundles. Lol. I definitely recommend this company for your bundles ladies. They are soft, hair bundles on the head for human hair wigs and I would continue to recommend them. I have thinner hair so they cover and blend nicely.