Reputation: 8032
My project has an error page called oops.aspx. We have the following code in global.asax
:
protected void Application_Error(object sender, EventArgs e)
{
Server.Transfer("~/oops.aspx", true);
}
oops.aspx
is able to extract the error, generate a nice email to the server, and present an error message to the user.
The use of Server.Transfer
preserves the URL, form information, and other helpful troubleshooting information. At one point in the oops.aspx, while composing the email, I grab Request.RawUrl and include it in the email. This is the URL (with query string parameters) of the page that caused the error.
We also have this in web.config:
<customErrors mode="On" defaultRedirect="oops.aspx"></customErrors>
When the system redirects because of an error based on this, it redirects to /oops.aspx?aspxerrorpath=/Clients/EditClient.aspx
(sometimes with /, sometimes with %2f path separators). Querystring and Exception information is lost, so the email and messages generated by oops.aspx are sparse and don't say much about what was happening.
I've been getting a lot of errors of this second kind lately. The errors happen in small bunches, several of them in a few minutes, and then nothing for several hours. They happen all over the site (including on WebResource.axd
and the like), which makes me think that it's not a specific error in our site but something happening at a lower level, like a Session server issue or something like that.
So, with all that, my actual question:
I'm having errors in the site that happen in such a way that they are not caught by global.asax. What can cause such errors, and how can I troubleshoot them?
Upvotes: 4
Views: 1176
Reputation: 1039398
Since you have enabled custom errors in your web.config, the exception will be caught before the Application_Error executes and redirect you to oops.aspx
. If you don't want this from happening do not enable custom errors in your web.config. This way all errors will go through Application_Error
assuming you have configured IIS to run the application pool in Integrated pipeline mode.
Upvotes: 6