Home » CodeDigest


Prevent or Disable Web.Config settings inheritance in ASP.Net
Submitted By Satheesh Babu B
On 6/9/2009 5:34:08 AM
Tags: ASP.Net,CodeDigest  

Prevent Web.Config settings inheritance in ASP.Net

Sometimes, we will have sub virtual directory to host sub sites under a parent site in IIS. Configuring a virtual directory under a site in IIS will make the parent site's Web.Config settings inherited to the child site. For example, if you have a website that uses some custom Http Modules and if you configure a virtual directory under this site to host a sub site, the sub site will throw an error that it's not able load the module assembly that you configured on parent site.


We can prevent this using location tag and making the inheritInChildApplications to false. You need to wrap the system.web settings of the parent site in location tag like below.


<location inheritInChildApplications="false">


This setting will prevent the child application to inherit the parent sites settings.

Do you have a working code that can be used by anyone? Submit it here. It may help someone in the community!!

Recent Codes
  • View All Codes..