2013-10-20 37 views
1

我在一個名爲「paypal」的子文件夾中,並試圖重定向到我的mvc頁面。我已經試過這3種方式我想重定向形式的頁面是一個WebForm從asp.net web表單重定向到mvc 4

Response.Redirect("../../SubscriptionView/Success/" + pdt.TransactionId.ToString()); 

Response.Redirect("../SubscriptionView/Success/" + pdt.TransactionId.ToString()); 

Response.Redirect("~/SubscriptionView/Success/" + pdt.TransactionId.ToString()); 

,並不斷得到

HTTP錯誤404.0 - 找不到 你正在尋找的資源已被移除,其名稱已更改,或暫時不可用。

... .COM:80 /貝寶/ subscriptionview /成功/ ...

如何看重定向沒有從PayPal的目錄上移?我究竟做錯了什麼?

+0

你不應該在MVC使用Response.Redirect的aspx頁面。請嘗試[RedirectToAction](http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.redirecttoaction(v = vs.108).aspx)。 – MikeSmithDev

+0

我創建了paypal監聽器,並根據他們的建議做了一個webform ...現在考慮我可以將它移動到視圖 – ChampChris

回答

2

我想出瞭如何讓它工作。

UrlHelper urlHelp = new UrlHelper(HttpContext.Current.Request.RequestContext); 
        response.Redirect(urlHelp.Action("PaymentError", "SubscriptionView", new { mailId = mailId })); 

這回我的,我需要處理來自PayPal響應返回給我的控制器