我需要在PayPal服務被用戶接受後重定向到頁面。我想重定向的頁面遵循以下結構:如何在ASPX中重定向到當前頁面的兄弟頁面或子文件夾頁面
- Me.aspx
- \寶\ Accept.aspx
- \寶\ Cancel.aspx
- \寶\ Finish.aspx
,所以如果我在http://localhost:63000/myfolder/me.aspx
我想通過貝寶被重定向到http://localhost:63000/myfolder/paypal/accept.aspx
如何?
我需要在PayPal服務被用戶接受後重定向到頁面。我想重定向的頁面遵循以下結構:如何在ASPX中重定向到當前頁面的兄弟頁面或子文件夾頁面
,所以如果我在http://localhost:63000/myfolder/me.aspx
我想通過貝寶被重定向到http://localhost:63000/myfolder/paypal/accept.aspx
如何?
好的。得到它的工作!
我可以使用HttpContext.Current讓我當前的URL,然後重寫當前頁面的子目錄和頁面:
ReturnURL = HttpContext.Current.Request.Url.AbsoluteUri.ToLower().Replace("me", "PayPal/Accept")
如果HttpContext.Current.Request.Url.AbsoluteUri是http://localhost:63000/myfolder/me.aspx
然後RETURNURL是http://localhost:63000/myfolder/PayPal/Accept.aspx
,PayPal沙盒正常返回。
ReturnURL = HttpContext.Current.Request.Url.AbsoluteUri.ToLower().Replace("me", "PayPal/Accept")
如果HttpContext.Current.Request.Url.AbsoluteUri是http://localhost:63000/myfolder/me.aspx然後RETURNURL是http://localhost:63000/myfolder/PayPal/Accept.aspx,和PayPal沙箱返回正常。
將其作爲答案,讓其他人可以輕鬆找到答案 – 2012-04-11 08:49:25
好的。得到它的工作! 我可以使用HttpContext.Current獲取我當前的Url,然後將當前頁面重寫到子目錄和頁面: ReturnURL = HttpContext.Current.Request.Url.AbsoluteUri.ToLower()。Replace(「me」,「PayPal /接受「) 如果'HttpContext.Current.Request.Url.AbsoluteUri'是 '的http://本地主機:63000/MyFolder文件/ me.aspx' 然後'ReturnURL'是 '的http:// localhost:63000/myfolder/PayPal/Accept.aspx', 和PayPal沙箱正常返回。 – 2012-04-11 08:45:57