2014-10-29 47 views
0

所以我有一個情況,我有一個webservice,應該採取一個調用者,並從通話做不同的東西,然後重定向到一個特定的地址來電者。使用webservice重定向到http地址

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

到目前爲止,我試圖玩弄一些HttpContext.Current.Response.Redirect(「地址」);但它並沒有真正把我帶到任何地方,所以我想我會在這裏問一些可能會讓我走得更遠的指導。

+0

的Response.Redirect( 「HTTP://www.microsoft.com/gohere/look.htm」);你是否指定shema? HTTP – alexsuslin 2014-10-29 13:20:19

回答

1

嘗試此代碼:

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; 
} 

實測值代碼herehere