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
eswarieswari 

Redirect to third party url - StatusCode=302

Hi,

 

I have a requirement to redirect to a third party url on click of  a submit button. I added the third party url to the Remote Site Settings and invkoing a method on click of 'submit' button.

 

When I click on the button it is redirecting to the same page with response as 'System.HttpResponse[Status=Moved Temporarily, StatusCode=302]'

 

Could any one suggest how to resolve this.

bob_buzzardbob_buzzard

When a 302 is returned, the server will also provide the new location.  You need to extract that from the headers and request it.

eswarieswari

Thanks for your reply.

 

I am able to get the new location from headers and requesting for the new url. Getting the response for that as 'Status=OK, StatusCode=200'.

 

But how can i redirect to that page from salesforce. I tried by giving the response as string in PageReference but it failed.

 

Please help on this.

 

bob_buzzardbob_buzzard

As you are accessing the initial page via code, why would you need to redirect the users browser to that page?