I\'ve got this in the web.config:
Ensure that you have the proper feature setting for the Error Page redirection in IIS. To check this, from the Error Pages page in IIS Manager, click Edit Feature Settings and make sure Custom error pages is checked if you are testing the redirects from the web server itself. If you are testing remotely, you can leave Detailed errors for local requests and custom error pages for remote requests is checked. This appears to be the default option in my test environment.
You may also need to set the existingReponse attribute in the httpErrors element like this:
<httpErrors errorMode="Custom" existingResponse="Replace">
<clear />
<error statusCode="404" prefixLanguageFilePath="" path="/ErrorHandler.aspx" responseMode="ExecuteURL" />
<error statusCode="500" prefixLanguageFilePath="" path="/ErrorHandler.aspx" responseMode="ExecuteURL" />
</httpErrors>
If you are using ExecuteURL, the custom error page path must be in the same application pool as the application itself.
For architectural reasons, IIS 7.0 can only execute the URL if it is located in the same Application Pool. Use the redirect feature to execute a Custom Error in a different Application Pool.
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>
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.