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

Page parameters get lost on refresh



I have a method in my controller that returns PageRerence to itself. However, when I submit a form what it attached to this method I get a page refresh but the URL parameters are lost...


Code in the controller method:

public PageReference login() {
	return ApexPages.currentPage();

The original url when I open that page for the first time:

 The url after I submit the form (the method login() executed):


Same goes for cookies, if I set Cookies on the currentPage() and then return it, I lose them after the refresh.


Any ideas what I'm doing wrong?


Thank you!


Andy BoettcherAndy Boettcher

Why would you refresh your page instead of doing a rerender of sections?  Odds are you'll have to set all of your parameters before returning the PR.




I would not want to do that because then I would have to have every page composed of multuple pages each separated with render="true/false". Does not sounds a like a good design idea.


We have a login screen that creates a session to our external platform and stores that in a cookie, if the user is missing the cookies I have to bounce the user around. I would not want to enclose the login page code within a section on each page (Leads, Accounts, Contacts).