Response.Redirect cannot be called in a Page callback
// Butchered together from multiple answers
if (!Page.IsCallback)
Request.Redirect("~/Error.aspx");
else
HttpContext.Current.Response.RedirectLocation =
System.Web.VirtualPathUtility.ToAbsolute("~/Error.aspx");