First of all, duh! If there are issues with the connection server, look into the Windows Application Event Log. But we'll get there.
The "error" appeared at any postback after I loaded a certain page, but only if that page displayed a minimum of data. Above that threshold I would get the server reset thing that you can see both in IE7 and FireFox2 in the animated GIF. Basically the error messages were:
The connection was reset
The connection to the server was reset while the page was loading.
Internet Explorer cannot display the webpage
Internet connectivity has been lost.
The website is temporarily unavailable.
The Domain Name Server (DNS) is not reachable.
Server returned error 12031
So, today I realised I should look in the Application Event Log and this Web Event Warning was displayed (shortened it a bit):
Event code: 3004
Event message: Post size exceeded allowed limits.
Process name: aspnet_wp.exe
Exception type: HttpException
Exception message: Maximum request length exceeded.
Stack trace: at System.Web.HttpRequest.GetEntireRawContent()
at System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
It turns out I was putting a lot of data into the ViewState, which, as you know, is saved as a HiddenField (a.k.a. hidden html input) and the size of it exceeded the set up maximum POST size.
A. Add this code to your page: (NET 2.0)
protected override PageStatePersister PageStatePersister
return new SessionPageStatePersister(this);
This should put your ViewState into the Session, rather than in the page. This solves some other issues as well, obviously.
B. Increase the maximum Request limit (default is 4Mb)
- In the Machine.config file, change the maxRequestLength attribute of the <httpRuntime> configuration section to a larger value. This change affects the whole computer.
- In the Web.config file, override the value of maxRequestLength for the application. For example, the following entry in Web.config allows files that are less than or equal to 8 megabytes (MB) to be uploaded:
<httpRuntime maxRequestLength="8192" />
This is an exact quote from the Microsoft support page.
That's it, folks!
The maxRequestLength maximum value is 2097151, that is less than 2.1Gb. No file that exceeds this size can be uploaded through the default upload mechanism.