Using web.config I configured IIS to redirect 500 errors to a custom page that is in my application.
<httpErrors errorMode="Custom">
<remove statusCode="500" />
<error statusCode="500" path="/Pages/ErrorPages/CustomError.asp" responseMode="ExecuteURL" />
</httpErrors>
This is working perfectly and it is redirecting to the mentioned classic asp page when there is a 500 error.
Now I want to capture the error details such as file path and line number from my custom error page, which shows on the standard error page when we set "Send errors To Browser" to TRUE and Error page features to "Detailed errors"
What are the methods I can use to solve this by configuring IIS and using javascript/jquery
As the Detailed Error overrides the content of my custom error page, I came up with a different approach to overcome my problem.
I Enabled Failed Request Tracking Rule on IIS and it creates a log folder inside inetpub\logs\FailedReqLogFiles
Inside that folder, It creates a separate error log (XML) for each Error. That XML has a format like below.
<failedRequest url="" siteId="" appPoolId="" processId="" verb="GET" remoteUserName="" userName="" tokenUserName="NT AUTHORITY\IUSR" authenticationType="anonymous" activityId="" failureReason="STATUS_CODE" statusCode="500" triggerStatusCode="500" timeTaken="" xmlns:freb="">
<Event>
<System></System><EventData></EventData><RenderingInfo></RenderingInfo><ExtendedTracingInfo></ExtendedTracingInfo>
</Event>
<Event>
<System></System><EventData></EventData><RenderingInfo></RenderingInfo><ExtendedTracingInfo></ExtendedTracingInfo>
</Event>
...
...
</failedRequest
I looped through Event tags and Selected the one with Event>System>Level is equal to 2. That is the event it shows as an Error when you preview the XML. Then you can read Event>EventData for Error LineNumber and Description.
From my custom error page, I requested information using an XHR call and stored it in a hidden field until required.