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
Mudasir WaniMudasir Wani 

Page Reference getContent method throwing an error.

Hi Guys,

For last few days we are facing an error in our existing code which uses PageReference.getContent.
When this peice of code runs it gives us following error.
"The page you submitted was invalid for your session. Please try your action again".

I have visited many blogs which are saying it is  a network problem.
We have checked it with different networks and on different salesforce instances as well and there is same result.

Can you please help.
Best Answer chosen by Mudasir Wani
Mudasir WaniMudasir Wani
Hi @Avidev9,

I was because of the following critical update "Enable CSRF protection on GET and POST requests" we need to deactivate this update.

Please refer to the knowledge article about the same.
https://help.salesforce.com/apex/HTViewSolution?urlname=Error-The-page-you-submitted-was-invalid-for-your-session-Please-click-Save-again-to-confirm-your-change&language=en_US

Best Regards,
Mudasir Wani.

All Answers

Avidev9Avidev9
This seems a bit weird, what are you trying to do ? are you trying to do a getContent of a VF page ?
Mudasir WaniMudasir Wani
Hi Avidev,

You are absolutely right.
The problem is that we have same peice of code in production and it is working fine.
i donot know whether it is an issue with Salesforce instance.

The page whose content we are trying to get in the Blob is rendered as pdf.

Best Regards,
Mudasir.
Mudasir WaniMudasir Wani
Hi @Avidev9,

I was because of the following critical update "Enable CSRF protection on GET and POST requests" we need to deactivate this update.

Please refer to the knowledge article about the same.
https://help.salesforce.com/apex/HTViewSolution?urlname=Error-The-page-you-submitted-was-invalid-for-your-session-Please-click-Save-again-to-confirm-your-change&language=en_US

Best Regards,
Mudasir Wani.
This was selected as the best answer