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.
This setting will prevent the child application to inherit the parent sites settings.