function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ApexGuyApexGuy 

ViewState

Do anyone know how I can discover the structure of viewstate information on a client VF page, and a way to translate it into readable characters?

gm_sfdc_powerdegm_sfdc_powerde
You will find view state as a hidden variable inside the form generated by apex:form.  The best way to find it is to capture the request that goes back to server when you click on a command button or command link.  I believe you cannot decrypt view state as it's internal to the platform and is not exposed to clients.  BTW, what's your use case? If you could elaborate, we can explore other ways to achieve your end goal.
ApexGuyApexGuy

I just want to know the format, such as whether it is for example base64 encoding. I am simply trying to understand viewstate. I do not have a use for reading the information other than to examine it a few times in order understand what is going on.

 

Still, if I could look at it, then I would have a better understanding of what information specifically is passed to the client and in what form.

 

Do you have a recommendation for a tool to capture the viewstate on its way back to the server? Is it in plain text then?

gm_sfdc_powerdegm_sfdc_powerde

>I just want to know the format, such as whether it is for example base64 encoding.

I am not sure about it.  I don't think it's published by Salesforce either.

 

> Still, if I could look at it, then I would have a better understanding of what information specifically is passed to the client and in what form.

According to Visualforce documentation, all non-transient instance variables in Visualforce controller get passed to client as view state as an encoded string.

 

>Do you have a recommendation for a tool to capture the viewstate on its way back to the server? Is it in plain text then?

It is encrypted text.  You can use any http proxy in your browser to view it. It's a form parameter with the name of viewstatevf or something like that. I use WebScarab, an open source Java-based tool and find it adequate for my needs.

 

ApexGuyApexGuy
Thanks to both of you for the tips. I tried WebScarab, and a few other tools. I thought that the viewstate might be like Microsoft viewstate, and I could just take a look at it, but that seems not to be the case. Anyway, in doing research on this I guess that I have learned enough for my needs.