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

Unable to redirect from Visualforce page to other website contact us page using Command Button.
Hello Everyone,
I had an issue with Commandbutton which I need to redirect the page from the Visualforce page to some other company Website Contact Us page.
Here is my CommandButton code and Controller class code.
VF Page CommandButton:
<apex:commandButton style="color:white; background-color:red; background-image:none; width:150px; height:35px" action="{!Cancel}" value="Cancel" />
Controller Class:
public PageReference Cancel(){
PageReference pr = new PageReference('/www.bren.com/residential/contact');
pr.setRedirect(true);
return pr;
}
Please help me with this issue.
Thanks and Regards,
Azar Khasim.
I had an issue with Commandbutton which I need to redirect the page from the Visualforce page to some other company Website Contact Us page.
Here is my CommandButton code and Controller class code.
VF Page CommandButton:
<apex:commandButton style="color:white; background-color:red; background-image:none; width:150px; height:35px" action="{!Cancel}" value="Cancel" />
Controller Class:
public PageReference Cancel(){
PageReference pr = new PageReference('/www.bren.com/residential/contact');
pr.setRedirect(true);
return pr;
}
Please help me with this issue.
Thanks and Regards,
Azar Khasim.
Try the below change in method it will work:
Public pagereference Cancel()
{
PageReference pr = new PageReference('https://www.bren.com/residential/contact');
pr.setRedirect(true);
return pr;
}
Thanks,
Maharajan.C
All Answers
Try the below change in method it will work:
Public pagereference Cancel()
{
PageReference pr = new PageReference('https://www.bren.com/residential/contact');
pr.setRedirect(true);
return pr;
}
Thanks,
Maharajan.C
Thank you it's working,
Actually, I have tried the same way yesterday, but it didn't work at that time.
Anyway thanks for your help Mr. Maharajan.
Thanks and regards,
Azar Khasim.