C# 如何重定向到当前页面';ASPX中的同级或子文件夹页

C# 如何重定向到当前页面';ASPX中的同级或子文件夹页,c#,asp.net,url,C#,Asp.net,Url,我需要将PayPal服务重定向到用户接受后的页面。我要重定向的页面遵循以下结构: Me.aspx \Paypal\Accept.aspx \Paypal\Cancel.aspx \Paypal\Finish.aspx 所以如果我在http://localhost:63000/myfolder/me.aspx 我想被贝宝重定向到http://localhost:63000/myfolder/paypal/accept.aspx 如何操作?ReturnURL=HttpContext.Curren

我需要将PayPal服务重定向到用户接受后的页面。我要重定向的页面遵循以下结构:

  • Me.aspx
  • \Paypal\Accept.aspx
  • \Paypal\Cancel.aspx
  • \Paypal\Finish.aspx
所以如果我在
http://localhost:63000/myfolder/me.aspx

我想被贝宝重定向到
http://localhost:63000/myfolder/paypal/accept.aspx


如何操作?

ReturnURL=HttpContext.Current.Request.Url.AbsoluteUri.ToLower().Replace(“我”、“贝宝/接受”)

如果HttpContext.Current.Request.Url.AbsoluteUri是ReturnURL,则PayPal sandbox会正确返回

好的。开始工作了

我可以使用HttpContext.Current获取当前Url,然后将当前页面重写到子目录和页面:


ReturnURL=HttpContext.Current.Request.Url.AbsoluteUri.ToLower().Replace(“我”、“贝宝/接受”)


如果HttpContext.Current.Request.Url.AbsoluteUri为
http://localhost:63000/myfolder/me.aspx
则返回URL为
http://localhost:63000/myfolder/PayPal/Accept.aspx
,PayPal沙盒将正确返回。

确定。开始工作了!我可以使用HttpContext.Current获取当前Url,然后将当前页面重写到子目录和页面:ReturnURL=HttpContext.Current.Request.Url.AbsoluteUri.ToLower().Replace(“我”、“PayPal/Accept”)如果
HttpContext.Current.Request.Url.AbsoluteUri
http://localhost:63000/myfolder/me.aspx
then
ReturnURL
is
http://localhost:63000/myfolder/PayPal/Accept.aspx
,PayPal sandbox将正确返回。请将其作为答案放在此处,以便其他人可以轻松找到解决方案