you can add a global.asax file to your project, and in your
application_error
method put this:
protected void Application_Error(object sender, EventArgs e)
{
string url = Request.QueryString[0];
Response.Redirect("/error.aspx?querystring=" + url);
}
this is not good because this method is for all errors in your root application and you should handle this and customize, you can use ELMAH for tracking error!