Solution to WebResource.axd exception

I have got several mail about how to solve the issue with the exception “The WebResource.axd handler must be registered in the configuration to process this request” that is quite common to get when you use EPiServer CMS.

My earlier hack in my blog post The mysterious problem with WebResource.axd is no longer needed since the cause is know.

Update: The cause and fix was originally found by Per Bjurstöm at EPiServer. I forgot to give him credit for this! Sorry.

Update: I think the documentation is a little bit confusing since it states: “The <add> directives are processed in top-down, sequential order. If two or more <add> subdirectives specify the same verb/path combination, the final <add> overrides all others”. Final should be interpreted as the one on top of the list. Values inherited from parent folders, the application web.config and machine web.config are at the bottom if the list – That is why path=”*” is so dangerous since it hides everything.

Summary and solution

The reason you get the WebResource.axd exception is that you (or in the case with EPiServer it is there as default) have added http handlers with wild card mapping to your web.config.

ASP.NET processes http handlers in the reverse order they are added so when a you add a wildcard mapping at the end it will effectively hide the WebResoruce handler.

To solve the issue: Add one line before each wild card mapping to re-register the http handler for WebResources like this:

<location path="PageFiles">
     <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="True"/> 
      <add path="*" verb="GET,HEAD" type="EPiServer.Web.StaticFileHandler, EPiServer" validate="true"/>