In my last post I discussed using the
Today I found a better way to control inheritance of the Http Handlers. The <add> element for Http Handlers has an attribute, validate, which tells ASP.NET whether it should load the class immediately or wait until a request comes. By default the value is set to true. Setting validate to false prevents the class from being loaded and thus eliminates the error.
In the case of the Google Site Maps handler, we had the following where validate was defaulting to true
<httpHandlers> <add verb="*" path="googlesitemap.axd" type="Newtonsoft.GoogleSitemap.GoogleSitemapHandler, Newtonsoft.GoogleSitemap"/> </httpHandlers>
We can change the add element to this to prevent ASP.NET from loading the googlesitemap.dll until we browse to googlesitemap.axd.
<httpHandlers> <add verb="*" path="googlesitemap.axd" type="Newtonsoft.GoogleSitemap.GoogleSitemapHandler, Newtonsoft.GoogleSitemap" validate="false”/> </httpHandlers>
Of course within your subsites, ASP.NET will generate an error if you try to browse to http://yourdomain.com/subsite/googlesitemap.axd. Ideally I wish there were an attribute like inheritance=false but until then this gets the job done.