Determine how much data is being stored in ViewState per control [duplicate]
Possible Duplicate:
How to decode viewstate
I've got a fairly complex page I'm working on, with lots of usercontrols, repeaters, etc.
The ViewState
on that page has ballooned up to over 4MB, which is causing a "Maximum Request Length Exceeded"
error on postback. The temporary fix would be to increase the maxRequestLength
attribute in HttpRuntime
, but that isn't fixing the root problem.
Is anybody aware of how could I inspect/query the ViewSt开发者_C百科ate to see which controls are the biggest offenders? What I'd like to try and avoid is spending a bunch of time optimizing a control that would only give me a couple kB in savings, while there are others on the page that could be stashing several hundred kB in ViewState
Thanks!
You can use:
- Fiddler Web debugging tool
- Enable Trace for particular page:
<%@ Page Language="c#" Trace="true"%>
- Enable Trace for whole Application in web.config so each page will show a lot of useful trace info at the bottom
<configuration>
<system.web>
<trace enabled="true" pageOutput="false" localOnly="false"/>
</system.web>
</configuration>
Helpful Trace indicators (in your case) are:
- Render Size bytes
- ViewState Size bytes
- ControlState Size bytes
精彩评论