Welcome Guest Search | Active Topics | Sign In | Register

RedirectLocation in ResourceHandler Options
gsvi
Posted: Friday, October 9, 2015 12:20:03 AM
Rank: Newbie
Groups: Member

Joined: 10/8/2015
Posts: 6
Hello,

I have implemented a resource handler and I would like to redirect the browser control to different URL.

Can you please provide some sample code on what the response object would need to have in order to make the control redirect?

I have tried

public override void ProcessRequest(Request request, Response response)
{
//Only process EmbeddedPageUrl
if (request.Url.Contains(UrlPrefix))
{
var url = new Uri(request.Url);
response.RedirectLocation = url.Host + "/process-page";
response.StatusCode = 302;
response.End();

}
}

Thanks
G
eo_support
Posted: Friday, October 9, 2015 10:48:28 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

Your code is correct. You can try the following code with our TabbedBrowser example and you should see it works fine:

Code: C#
if (string.Compare(request.Url, EmbeddedPageUrl, true) == 0)
{
    response.RedirectLocation = "http://www.google.com";
    response.StatusCode = 302;
    response.End();
}


Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.