When your post has exceeded the max length

When there is alot of data in a POST, or when uploading large files in .NET, the following error may be received:

System.Web.HttpException: Maximum request length exceeded

This error relates to ASP.NET's maxRequestLength setting. By default, ASP.NET limits requests to 4096 kilobytes (or 4 MB), as explained in this Microsoft KB article: https://support.microsoft.com/default.aspx?scid=kb;EN-US;295626. This error will occur if an upload is larger than 4 MB and you have not adjusted the maxRequestLength setting for your application in web.config or machine.config.

Solution:

In Web.config, within <system.Web>, add the following: <httpRuntime maxRequestLength="102400"/> , where 102400 allows a max of 100MB data to be uploaded/posted.

Comments