I have written a code in webforms to redirect to the custom error page in web.config
file.
<customErrors mode="On" defaultRedirect="~/ErrorPages/Oops.aspx">
<error statusCode="500" redirect="~/ErrorPages/StatusCode500.aspx" />
</customErrors>
And I have written a code which gives me database error.
and the code for StatusCode500 is:
<div class="d-flex justify-content-center">
<h1 style="color: #00AEC0">Oops..Could not connect to Database. </h1>
</div>
<div class="d-flex justify-content-center">
<h4 style="color: #00AEC0">Please contact your Network Administrator</h4>
</div>
It works absolutely fine, but now what I need is I need to pass the exceptional message (Divided by zero error in this case) to the StatusCode500 page just below Please contact you network administrator . How can I pass that exceptional message or Error Id?