tags:

views:

494

answers:

2

I've got this in the web.config:

<httpErrors errorMode="Custom">
  <remove statusCode="404" subStatusCode="-1" />
  <remove statusCode="500" subStatusCode="-1" />
  <error statusCode="404" prefixLanguageFilePath="" path="/Error/NotFound.aspx" responseMode="Redirect" />
  <error statusCode="500" prefixLanguageFilePath="" path="/Error/ServerError.aspx" responseMode="Redirect" />
</httpErrors>

But IIS still shows the built in error page.

Any ideas?

A: 

It seems as though you are using a server relative URL, try setting responseMode="ExecuteURL", from MSDN.

ExecuteURL

Serves dynamic content (for example, an .asp file) specified in the path attribute for the custom error. If responseMode is set to ExecuteURL, the path value has to be a server relative URL. The numeric value is 1.

Redirect

Redirects client browsers to a the URL specified in the path attribute that contains the custom error file. If responseMode is set to Redirect, the path value has to be an absolute URL. The numeric value is 2.

Phaedrus
+1  A: 

This is how I am using it and it works to me, it looks pretty similar except for the subStatusCode directives and the ExecuteURL.


<httpErrors>
     <!--Remove inherited 500 error page setting -->
     <remove statusCode='500' subStatusCode='-1'/> 
     <!--Override the inherited 500 error page setting with the 'My500.html' as its path-->
     <error statusCode='500' subStatusCode='-1' prefixLanguageFilePath='' path='/My500.html' responseMode='ExecuteURL'/> 
</httpErrors>
Freddy