15
Views
2
Comments
Solved
How to redirect to an external URL from a server action?
Question

I have an exposed rest service in my application, and I am trying to handle a GET request, then based on it I have to redirect the user to another URL from the internet.

I have tried the server action "AddMetaHttpEquivTag" to force a HTML redirect like

<meta http-equiv="refresh" content="time; URL=new_url" /> 

but it didn't work.

Does anyone have an idea about how to solve this?

Rank: #70
Solution

Hi Edgar,


You can add a header Location using AddHeader from HttpRequestHandler extension and then set the Status Code (using SetStatusCode also from HttpRequestHandler) to 308 for Permanently Moved or 307 for Temporarily Moved:



And then the SetStatusCode to 308:



Hope it helps.


Cheers,

João