Use the Application_Error event handler in the global.asax file to redirect the user to ~ / error / meh.aspx
in global.asax
protected void Application_Error(object sender, EventArgs e) { Response.Redirect("~/error/404.aspx"); }
In your web.config also add
<customErrors mode="On" defaultRedirect="/error/404.aspx" />
source share