Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's a good way to determine what's in my viewstate?

I have a page that has a really huge viewstate (>300KB). ...Yeah, I know. I've narrowed this anomaly down to one user control, but am having trouble determining what exactly that control is putting in there.

I've overridden SavePageStateToPersistenceMedium in the page, but am not great at working with the viewstate object passed in. Could I pass it in to some recursive function that would print out everything that's in the object?

I've tried using freely available viewstate decoders, but none have worked. I always get errors when it attempts to deserialize the viewstate.

I'm pretty much looking for a code snippet here.

Thanks,
Mark

Thanks for the traceing suggestion, esp. the trace.axd thing. But that still only tells me how big the controls are, it doesn't tell me what's in the viewstate. I want to be able to see if there are objects that I'm erroneously serializing to viewstate.

like image 318
MStodd Avatar asked Nov 05 '22 21:11

MStodd


2 Answers

I used to use trace.axd. It lists each request and dumps the contents of the viewstate. You'll have to enable tracing in web.config. If you've got lots of requests you'll want to update the cache size to more than 10.

like image 60
Shea Avatar answered Dec 01 '22 00:12

Shea


Fritz Onion's ViewState Decoder is what you need!

like image 21
Andrei Rînea Avatar answered Dec 01 '22 00:12

Andrei Rînea