Response.Redirect not working in Global.asax
Replace Response.Redirect("~/Error.aspx");
with:
// You've handled the error, so clear it. Leaving the server in an error state can cause unintended side effects as the server continues its attempts to handle the error.Server.ClearError();// Possible that a partially rendered page has already been written to response buffer before encountering error, so clear it.Response.Clear();// Finally redirect, transfer, or render a error viewResponse.Redirect("~/Error.aspx");