You need to sign in to do that
Don't have an account?

Site.login startUrl returning only 1st parameter
Hi I have following piece of code,
startUrl = '/home?a=' + value1 + '~b=' + value2;
PageReference page = Site.login(username, password, startUrl);
String temp = page.getParameters().get('retURL');
temp = temp.replaceAll('~', '&');
page.getParameters().put('retURL', temp);
return page;
Here the returnURL shows the correct url but after the actual redirect it just redirects to the page with the 1st parameter, so i get
'/home?a=' + value1
which is wrong....
Can you provide more information, as to from where are you retrieving the retURL and whats the purpose of replacing a ~, when you are creating the startURL by your own.
If your previous page has some retURL and you are trying to override it, so I guess that’s not required, as Site.login will pick the startURL only and will redirect your page correctly.
So basically the problem is when I am passing startUrl to Site.login method it gives me a return URL but the retURL only contains the 1st parameter and discard rest of the parameters. I want to retURL to have all the parameters.
So I am not getting the correct retURL.....
hi
can any one tell me where should i give the value of startURL...?
I finally figured out a solution to this problem - it has to do with URL encoding. If you replace all ampersand values in your startURL parameter with the URL-encoding reference %26, it will solve your problem, and all the parameters initially passed in will persist when your user hits the ultimate destination.
If you previously had something like:
startUrl=/home?a=value1&b=value2
Try switching it to this:
startUrl=/home?a=value1%26b=value2