I need to see the contents of the viewstate of an asp.net page. I looked for a viewstate decoder, found Fridz Onion's ViewState Decoder but it asks for the url of a page to get its viewstate. Since my viewstate is formed after a postback and comes as a result of an operation in an update panel, I cannot provide a url. I need to copy & paste the viewstate string and see what's inside. Is there a tool or a website exist that can help viewing the contents of viewstate?
Use Fiddler and grab the view state in the response and paste it into the bottom left text box then decode.
Darren's suggestion worked but apparantly decoder did not like my viewstate string. It gives a "the serialized data is invalid" message.
As another person just mentioned, it's a base64 encoded string. In the past, I've used this website to decode it:
You can ignore the URL field and simply paste the viewstate into the Viewstate string box.
It does look like you have an old version; the serialisation methods changed in ASP.NET 2.0, so grab the 2.0 version
@blowdart:
I already have that version.
I also tried with the site joshhinman has suggested but what i got was some meaningless chars. May be there is a problem with my viewstate string. Is it possible (since it is auto-generated, i do not think it is broken)?
buyutec, stupid question: are you encrypting your viewstate? If you are, you (obviously) won't be able to decode it. I imagine you probably already thought of this, but it shouldn't go unmentioned.
Normally, ViewState should be decryptable if you have the machine-key, right? After all, ASP.net needs to decrypt it, and that is certainly not a black box.
What happens if ASP.NET cannot read it?
I have a repeater on the page which loses its data. When the page posts back, i cannot see its items through Items property. That's why I am trying to read the viewstate and check for a problem. May a broken viewstate be the reason?
@Michael
of course, you are correct. I meant that if it's encrypted, you won't be able to decode it easily