我正在尝试将一些大字符串添加到可变类型的字符串中,但这会导致错误。
string SuccessUrl = "~/Customer/Success.aspx?URL=" + Server.UrlEncode("Transactionid="
+ Transactionid + "&Amount=" + Amount + "&Name=" + Name +
"&EmailOfPayer=" + EmailOfPayer + "&bussness=" + business + "&CompanyName=" + CompanyName
+ "&PaymentDate=" + paymentDateTime +"&SecuritiesandComplianceFee=" + SecuritiesandComplianceFee
+"&Status=" + Convert.ToInt32(Status) + "&BackmyUri=" + BackmyUri);
由于最后一个变量BackmyUri
,我出错了。该变量具有以下字符串值。
string BackmyUri =“ http://localhost:11181/Payment.aspx”
它给出一个错误。 输入的字符串格式不正确。
任何帮助将不胜感激。
答案 0 :(得分:2)
Input string was not in a correct format.
很可能是int.Parse()
和`Convert.ToInt32'的默认错误消息。您应该检查一下。对我们来说另一有用的事情是向我们展示一个导致错误的示例,并显示以下结果:
var x = "Transactionid=" + Transactionid + "&Amount=" + Amount + "&Name=" + Name +
"&EmailOfPayer=" + EmailOfPayer + "&bussness=" + business + "&CompanyName=" + CompanyName
+ "&PaymentDate=" + paymentDateTime +"&SecuritiesandComplianceFee=" + SecuritiesandComplianceFee
+"&Status=" + Convert.ToInt32(Status) + "&BackmyUri=" + BackmyUri