<location path="Documents/Upload"><system.web><!-- 50MB in kilobytes, default is 4096 or 4MB--><httpRuntime maxRequestLength="51200" /></system.web><system.webServer><security><requestFiltering><!-- 50MB in bytes, default is 30000000 or approx. 28.6102 Mb--><requestLimits maxAllowedContentLength="52428800" /></requestFiltering></security></system.webServer></location>
//Global.asaxprivate void Application_Error(object sender, EventArgs e){var ex = Server.GetLastError();var httpException = ex as HttpException ?? ex.InnerException as HttpException;if(httpException == null) return;
if (((System.Web.HttpException)httpException.InnerException).WebEventCode == System.Web.Management.WebEventCodes.RuntimeErrorPostTooLarge){//handle the errorResponse.Write("Too big a file, dude"); //for example}}