How to redirect to an external URL from a server action?

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?


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.



Worked perfectly like a charm!

Thanks a lot, João.

Hi Joao, can you please attach a sample oml for the above solution if possible.



In my case its not takes place any redirection. con you attach sample working oml please



Same. No redirection takes place.  
In this instance, does the client side code need to handle to handle the 308 and redirect to the Location address in the response header?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.