Drakthal
Drakthal

Reputation: 193

Redirecting to http address with webservice

So i have a case where i have a webservice that should take a caller and from the call do different stuff and then redirect the caller to a specific address.

public Response myWebservice(jsonObject json)
{
    {
          //Do other stuff
    }
          //Redirect to http://www.myaddress.com/myaddress
}

So far i have tried to play around with some HttpContext.Current.Response.Redirect("address"); but it hasnt really brought me anywhere so i thought i would ask here for some guidance that might get me a bit further down the road.

Upvotes: 0

Views: 68

Answers (1)

Renatas M.
Renatas M.

Reputation: 11820

Try this code:

public Response myWebservice(jsonObject json)
{
    {
          //Do other stuff
    }
    //Redirect to http://www.myaddress.com/myaddress
    Context.Response.StatusCode = 307;
    Context.Response.AddHeader("Location","http://www.myaddress.com/myaddress");
    return null;
}

Found code here and here

Upvotes: 1

Related Questions