I have the following in my web.config
<httpErrors errorMode="Custom">
<remove statusCode="500" subStatusCode="-1" />
<error statusCode="500" prefixLanguageFilePath="" path="/error.asp" responseMode="ExecuteURL" />
</httpErrors>
The error handling is working in that, when a 500 error occurs, I am sent to my error.asp instead of the default 500 error page.
The issue is that none of the properties of the ASPError object returned by Server.GetLastError are set.
For example, in the code below, the error description is
dim oErr : set oErr = Server.GetLastError
Response.Write "Error Description: " & oErr.Description& "<br />"
Update
Based on the thread Joel linked to in the comments, I’ve updated my web.config to the following:
<httpErrors errorMode="Custom">
<remove statusCode="500" subStatusCode="100" />
<error statusCode="500" subStatusCode="100" prefixLanguageFilePath="" path="/error.asp" responseMode="ExecuteURL" />
</httpErrors>
This does give me data in the ASPError object returned by GetLastError.
The issue now is that I’m getting the HTML from the beginning of the page where the error is generated, then the rest of the page is the HTML from error.asp.
I’d really like it to redirect to error.asp instead but changing the web.config to responseMode="Redirect" doesn’t seem to work.
Here’s the solution that’s working for me.
Setup up the web.config like this:
A simple error.asp might look like this:
The key to my problems appears to be having
On Error Resume NextandResponse.Clear.I found the solution on the Creating Custom ASP Error Pages Microsoft KB article (Q224070).