我对kentico中的应用程序开发有一个疑问。 在kentico中,response.redirect不起作用。 并且代码不是错误,但它没有重定向到kentico中的已发布网址
我在.Net应用程序的.cs页面中编写了如下代码
protected void btnPay_AsPerYourChoice(object sender, EventArgs e)
{
string name = "", city = "", itemname = "", amount = "", phone = "", iteminformation = "",currency="";
iteminformation = txtPurpose.Text;
name = txtName.Text;
city = "Hyderabad";
itemname = "Dresses";
amount = txtAmount.Text;
phone = "7207727159";
currency = ddlCurrency.SelectedValue.ToString();
string redirecturl = "";
redirecturl += "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=" + ConfigurationManager.AppSettings["paypalemail"].ToString();
redirecturl += "&first_name=" + name;
redirecturl += "&city=" + city;
redirecturl += "&state=Odisha";
redirecturl += "&item_name=" + itemname;
redirecturl += "&amount=" + amount;
redirecturl += "&night_phone_a=" + phone;
redirecturl += "&item_name=" + "iteminformation";
redirecturl += "&address1=" + "padma85.it@gmail.com";
redirecturl += "&shipping=0";
redirecturl += "&handling=0";
redirecturl += "&tax=0";
redirecturl += "&quantity=1";
redirecturl += "¤cy=" + "Rs";
redirecturl += "&return=" +
ConfigurationManager.AppSettings["SuccessURL"].ToString();
redirecturl += "&cancel_return=" +
ConfigurationManager.AppSettings["FailedURL"].ToString();
Response.Redirect(redirecturl);
}
以下代码位于web.config文件中:
<add key="token" value="PW1BDVNqVPVanwduF_Tb2Ey91aT1Uhx1kL7HPc-7e8S-6AnUwSSHyasolSe"/>
<add key="paypalemail" value="k.tapankumar@gmail.com"/>
<add key="PayPalSubmitUrl" value="https://www.paypal.com/cgi-bin/webscr"/>
<add key="FailedURL" value="http://www.mrsoft.co.in/ProceedToPayment.aspx"/>
<add key="SuccessURL" value="http://www.mrsoft.co.in/ProceedToPayment.aspx"/>
答案 0 :(得分:3)
尝试使用Kentico的API代码来执行重定向:
URLHelper.Redirect()