Control web.config inheritance with IIS 7, ASP.NET options

A person I work with was looking to control web.config inheritance in sub-folders within a website.   Through some research, asking on an geek mailing list, here is three options that came out.  Two are IIS based , one is using ASP.NET.  Hope this helps

Option #1 

Thanks to Robert McMurray for this one!

“You can set the enableConfigurationOverride attribute to false for an application pool. For example, we set that attribute to false for the FPSE application pool so if a bad web.config file is uploaded to a web site you can still upload an updated file through FPSE that will fix the problem.  I sometimes follow that paradigm for WebDAV-enabled sites – I’ll create a public site in an application pool with enableConfigurationOverride set to true and then I’ll create a private site in an application pool with enableConfigurationOverride set to false.”

See the attributes in the following URLs for more:

Option #2 

Thanks to Mike Volodarsky for this tip.

“That can be accomplished by setting allowSubDirConfig=false in the application definition (applicationHost.config)”

Option #3 

Thanks Scott Forsyth for the reminder.  This is the option I’m most familar with using and works.  It’s a little tricky when you have 1.1 and 2.0 within the same website, for example, 2.0 at the root and 1.1 in a virtual directory.  You are better off using 1.1 at the root, 2.0 in a sub-folder if you are required to use such an architecture.   I’d suggest having separate websites and not mixing ASP.NET versions within the same website.

ASP.NET – Click the link for more information

inhertInChildApplications property


Steve Schofield
Microsoft MVP – IIS