Most ASP.Net developers quickly learn that web.config file settings percolate from the top down. This is commonly used to provide global configuration for a single web application, but it's pretty easy to forget that web.config settings can be inherited across different virtual directories.
For example:
1) Create a website in IIS.2) Create a virtual directory for a second site underneath the IIS website.3) Reference a type in the web.config for site #1, such as in a HttpHandler block.4) Unless the second site has the type referenced in #3 (or it is in the GAC), second site will now immediately throw an exception, "Cannot load type xxx.xxx.xxx".
In web.config #1<
This issue is caused because every virtual directory underneath the top-level website is inheriting settings from the top-most web.config. Many of these inherited settings would go unnoticed, but as soon as the child virtual directory hits something it can't handle, it immediately throws a show-stopping (as all config errors are) exception.
Quick Solution?Wrap application specific blocks of code in the LOCATION tag. Obviously this must be used judiciously, but it's a useful fix to a sneaky problem.
<
For a detailed discussion of this topic, see this useful article on www.aspdotnetfaq.com.
Page rendered at Friday, September 05, 2008 11:27:42 AM (US Mountain Standard Time, UTC-07:00)
Disclaimer The opinions expressed herein are really cool. But they are still JUST opinions.