1
votes

We're running a site built in EPiServer (CMS5 R2, latest version) and ASP.NET 3.5 that's running on IIS7, we've built a custom error handler that utilizes the URLRewriter-functionality of EPiServer to handle 404 and 301 status codes, everything works locally (Windows 7 + IIS7.5) but we just can not get the 404 pages to work on the live server (Windows 2008 Server + IIS7). The 301-redirects work but for the 404-page we just get the default IIS7 message:

iis7 default 404 message http://episerversucks.com/upload/iis7_error.png

The handler is obviously getting fired since the pre-defined 301-redirects work (URLs from an old site that we need to redirect to the new site), but for the 404 IIS7 just replaces them with it's default message.

The 404 handler works in such a way that is does an internal redirect to a page /Pages/Error404.aspx that display a nice customized 404-page in an appropriate language and sets it's own status code to 404 through Response.StatusCode = 404; I got the tip from a site to change TrySkipIisCustomErrors variable to true, i.e. Response.TrySkipIisCustomErrors = true;but that didn't help either.

The only configuration difference I've found between the local dev machines and the server is that the local machines have a configuration setting called ".NET Error Pages" and a setting called just "Error Pages", while the live server only has the setting called "Error Pages" and is missing the .NET Error pages ones, but I've found no way to add the .NET Error Pages config dialog to the server, is it IIS7.5 specific?

I've been digging my way through this for the better part of a day and just can not find a solution that seems to work, so I turn here.

Edit: The local dev version and the live version have identical web.config's, settings, etc. (except for the database connection string obviously)

1

1 Answers

2
votes

Ok so I solved it, the problem was setting the errorMode to "Detailed."

<configuration>
    <system.webServer>
       <httpErrors errorMode="Detailed" />
    </system.webServer>
</configuration>

If it's on Custom the IIS7-error handler intercepts all pages that return 404 and switches the response out.