Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Custom error handling for 404 errors on PageFiles folder

Vote:
 

I am trying to implement custom 404 error handling for requests to the PageFiles virtual folder. I have updated the location section in web.config to this:

  <location path="PageFiles">
    <system.webServer>
      <httpErrors errorMode="Custom" defaultPath="/App_Error500.htm">
        <remove statusCode="404" subStatusCode="-1" />
        <error statusCode="404" subStatusCode="-1" path="/HttpHandlers/ImageResizingHandler.ashx" responseMode="ExecuteURL" />
      </httpErrors>
      <handlers>
        <add name="webresources" path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" />
        <add name="wildcard" path="*" verb="*" type="EPiServer.Web.StaticFileHandler, EPiServer" />    
      </handlers>
    </system.webServer>
    <staticFile expirationTime="-1.0:0:0" />
  </location>

 

Now, when I make a request for a file that does not exists in /PageFiles/ I get the following error:

 

Module CustomErrorModule
Notification SendResponse
Handler wildcard
Error Code 0x80070021
Config Error Lock violation
Config File \\?\C:\Development\Managed\Bauer.Parkers\Freda\Src\Bauer.Parkers.Web\web.config

I have unlocked the appropriate sections in applicationHost.config to allow me to override custom errors, however I am not sure what I need to unlock to resolve the lock violation caused by the wildcard handler (EPiServer.Web.StaticFileHandler).

 

Any info on getting this working would be most welcome, thanks.

 

#49264
Mar 10, 2011 13:06
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.