views:

127

answers:

3

In an ASP.NET Web application, I have a page with an update panel. In this updatepanel, the user can click on an icon to add or remove controls to a repeater.

I put a breakpoint in the Page.Load of the updatepanel and checked the HttpContext.Current.Request.ContentLength every time the updatepanel is used. The request increases in size every time a request is sent.

The funny thing is that it even increases in size when the user removes the controls (so the page becomes 'lighter' again).

In the end, this gives me the following error: maximum request length.

The solutions around the web suggest to increase the maximumRequestLength. This is not an option because I'll reach the maximum anyway.

I've even noticed the request length increases exponentially.

Anyone had the same experience?

+1  A: 

Off the top of my head, it sounds like you could be hitting a ViewState issue here. If the length is increasing regardless of what's happening, I suspect that items are being added into the ViewState and not removed. The funny thing is, a lot of times you don't need ViewState, but people leave it turned on.

Pete OHanlon
A: 

Sounds like you have static reference at the request level. I have seen this before in a base page. What happens is that nothing can be disposed and it just grows and grows.

rick schott
+2  A: 

you are probably constantly adding attributes to your controls. Something like on page_prerender buttonSave.Attributes("onclick") += "this.className='buttonhide';"

This was indeed the case. Every time there was a partial postback, we added some attributes to one of our controls, which kept making it bigger and bigger. And that also made the viewstate bigger and bigger, which in turn made the request bigger.
Peter