+ Start a Discussion
sfdcdev.wordpress.comsfdcdev.wordpress.com 

pageRef.setRedirect(false) not working suddenly

Hello,

This is so frightening when something like this happens.

We had the following code
Code:
                  pageRef = new PageReference(url); 
                  pageRef.setRedirect(false);
                  return pageRef;

It was working just fine up until two days ago. Suddenly, it stops working and the Visual Force page sits in the intermediate page and nothing happens after the method executes in the controller. Is there any change recently that I am not aware of. Please respond.

Thanks,
Girish Suravajhula.

 



Message Edited by Girish989 on 09-11-2008 07:48 AM
ESES
Working fine for me. You can only be forwarded from page1 to page2 if the two have same controller. Otherwise you are redirected. May be you changed the controller of the page you want to go to that resulted in change of behavior for you.

Following is a quick example that shows two pages using the same controller to utilize the forwarding capability.


Code:
page1: 
<apex:page controller="fwd">
<apex:form >
<apex:commandButton value="fwd" action="{!forward}"></apex:commandButton>
</apex:form>
</apex:page>

page2:
<apex:page controller="fwd">
This is page 2
</apex:page>

public class fwd {
    public PageReference forward() {
       PageReference p = Page.page2;
       p.setRedirect(false);
       return p;
    }
}

 


sfdcdev.wordpress.comsfdcdev.wordpress.com
Thanks for the reply.

But I am using the same controller, and the code was working up until yesterday. I have no idea what got changed.

Right now the only solution I see is to redirect the page. Pass the parameters in URL and query again the second page. I guess I would be doing that.

Regards,
Girish


ESES
You are welcome to copy/paste simplified markup/controller that reproduces the issue here. We may be be able to help you out if we can reproduce the problem.
dchasmandchasman
I believe this is the result of a change that went out in the latest patch that was required to remove a recently discovered script injection vulnerability and your code only worked before because it might have been benefiting from an unintended side effect of the hole we just closed. Are you accessing query params in the page you are forwarding to? How are you invoking the action method - e.g. via a commandLink or commandButton? I suspect you are not using apex:param to explicitly pass params to your action...