I have an error.aspx
page. If a user comes to that page then it will fetch the error path in page_load()
method URL using Request.QueryStrin
To resolve your problem, write the following line on your page's Page_Load method.
if (String.IsNullOrEmpty(Request.QueryString["aspxerrorpath"])) return;
.Net 4.0 provides more closer look to null, empty or whitespace strings, use it as shown in the following line:
if(string.IsNullOrWhiteSpace(Request.QueryString["aspxerrorpath"])) return;
This will not run your next statements (your business logics) if query string does not have aspxerrorpath.