问题描述
我做的ASP.NET应用程序简单Paypal付款的整合,我试图建立这两个成功和放大器返回的查询字符串;取消,但因为我在查询字符串发送多个参数这是行不通的。
I'm doing simple Paypal payment integration in ASP.NET app., I tried to build the returning query string for both success & cancel but it doesn't work because I'm sending more than one parameter in the querystring
string returnUrl = ConfigurationManager.AppSettings["PayPalSandBoxUrl"] + "&business=" + email;
returnUrl += "&amount= 100";
returnUrl += "&item_name=Invoice to somebody";
// the problem goes in following params
returnUrl += "&return=" + ConfigurationManager.AppSettings["Domain"] + "Payment.aspx?param1=" + param1 + "¶m2=" + param2 ;
returnUrl += "&cancel_return=" + ConfigurationManager.AppSettings["Domain"] + "Payment.aspx?cancel=true¶m1=" + param1;
我觉得它得到贝宝请求参数和返回的查询参数之间有些混乱,有什么解决方案呢??
I think it gets some confusion between paypal request parameters and the return query parameters , is there any solution for this ??
推荐答案
当您添加在包含能够迷惑真正的参数应用的符号,如?
的URL参数,&安培;
, /
等,必须设有code他们用的
When you add on the URL parameters that contains symbols that can confuse the real parametres, symbols as ?
, &
, /
etc, you must encode them with the UrlEncode
所以,让你的字符串:
string returnUrl =
ConfigurationManager.AppSettings["PayPalSandBoxUrl"]
+ "&business=" + HttpServerUtility.UrlEncode(email);
returnUrl += "&amount= 100";
returnUrl += "&item_name=" + HttpServerUtility.UrlEncode("Invoice to somebody");
// the problem goes in following params
returnUrl += "&return="
+ HttpServerUtility.UrlEncode(ConfigurationManager.AppSettings["Domain"] + "Payment.aspx?param1=" + param1 + "¶m2=" + param2) ;
returnUrl += "&cancel_return="
+ HttpServerUtility.UrlEncode(ConfigurationManager.AppSettings["Domain"] + "Payment.aspx?cancel=true¶m1=" + param1 );
这篇关于贝宝的多参数的回报,cancel_return网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!