Maximum request length exceeded exception on postback Maximum request length exceeded exception on postback asp.net asp.net

Maximum request length exceeded exception on postback


A postback sends back the viewstate of every control - if you have a huge datagrid, then when the browser reposts that to the server, this is why you are getting the exception.

Your two options are:

  1. Set EnableViewState="false" on your GridView if you do not need the viewstate, so it's not so bloated and the postback is a reasonable size,
  2. Increase the maximum request size in web.config as shown below:

    <configuration>    <system.web>        <httpRuntime maxRequestLength="32768" />    </system.web></configuration>

Hope this helps