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
TehNrdTehNrd 

Page redirects break in Summer09

Some of our page redirects are breaking with summer09. Here is simple example to reproduce.

 

 

<apex:page controller="redirect"> <apex:form > <apex:commandButton value="Go back!" action="{!back}"/> </apex:form> </apex:page> public class redirect { public PageReference back() { PageReference returnpage = new PageReference('/' + System.currentPageReference().getParameters().get('retURL')); returnPage.setRedirect(true); return returnPage; } }

Use a URL like this: https://cs1.salesforce.com/apex/redirect?retURL=someId.

 

In Spring 09 the page would return you to https://cs1.salesforce.com/someId.

In Summer 09 it returns https://someId.

 

The domain is being left out.

 

Thanks,

Jason

 

 

Best Answer chosen by Admin (Salesforce Developers) 
altaiojokaltaiojok

Workaround: remove the extra slash when creating the PageReference for retURL:

 

PageReference returnpage = new PageReference(ApexPages.currentPage().getParameters().get('retURL'));    

 

All Answers

TehNrdTehNrd
Case#  02730894
TehNrdTehNrd

Has something to do with the retURL parameter. It doesn't like it.

 

If I use something else it works fine.

 

 

<apex:page controller="redirect">
<apex:form >
<apex:commandButton value="Go back! URL" action="{!back}"/>
<apex:commandButton value="Go back! ID" action="{!back1}"/>
</apex:form>
</apex:page>

public class redirect {

public PageReference back() {
PageReference returnpage = new PageReference('/' + ApexPages.currentPage().getParameters().get('retURL'));
returnPage.setRedirect(true);
return returnPage;
}

public PageReference back1() {
PageReference returnpage = new PageReference('/' + ApexPages.currentPage().getParameters().get('id'));
returnPage.setRedirect(true);
return returnPage;
}

}

Still frustrating as I must scramble to patch this :smileyindifferent:

 

Message Edited by TehNrd on 06-16-2009 10:57 AM
altaiojokaltaiojok

Workaround: remove the extra slash when creating the PageReference for retURL:

 

PageReference returnpage = new PageReference(ApexPages.currentPage().getParameters().get('retURL'));    

 

This was selected as the best answer
TehNrdTehNrd
Thanks. I ended up changing everything that had 'retURL' to 'ret' and that worked as well.