void Application_Error(object sender, EventArgs e) { // Code that runs when an unhandled error occurs HttpException h = Server.GetLastError() as HttpException; if (h != null && h.WebEventCode == System.Web.Management.WebEventCodes.RuntimeErrorPostTooLarge) { try { Server.ClearError(); Page page = HttpContext.Current.CurrentHandler as Page; if (page is Page) { page.ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>alert('error');< / script>"); } } catch (Exception) { } } }
Application_BeginRequest
<configuration> <system.web> <httpRuntime maxRequestLength="x" /> </system.web> </configuration>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)