2014-03-03 64 views
0

我已經調用了一個重定向到另一個頁面的方法。完成另一頁後,我想從上一頁返回。這是我的代碼:如何從其他頁面返回頁面?

private string RedirectToPaymentGateway_v3(string MTrackid, string MAmount,string MSType) 
{ 
    HttpContext.Current.Session["pgMTrackid"] = MTrackid; 
    HttpContext.Current.Session["pgMAmount"] = MAmount; 
    HttpContext.Current.Session["pgMStype"] = MSType; 
    HttpContext.Current.Response.Redirect("DoPost.asp", true); 

    return ""; 
} 

完成dopost.asp我想要在我打電話DoPost.asp頁面後返回。

+0

試試這個'HttpContext.Current.Response.Redirect( 「DoPost.asp」,false);' –

回答

0

經過原點頁面作爲參數,並隨後重定向到它:

private string RedirectToPaymentGateway_v3(string MTrackid, string MAmount,string MSType) 
{ 
    HttpContext.Current.Session["pgMTrackid"] = MTrackid; 
    HttpContext.Current.Session["pgMAmount"] = MAmount; 
    HttpContext.Current.Session["pgMStype"] = MSType; 
    HttpContext.Current.Response.Redirect("DoPost.asp?ReturnUrl=" + 
Server.UrlEncode(Request.Url.ToString()); 

    return ""; 
} 

,然後在DoPost.asp處理後做

Response.Redirect(Server.UrlDecode(Request.Querystring["ReturnUrl"])); 
相關問題