我正在致力於電子商務網站。最後,我需要整合我正在使用payuBiz的支付網關。在解析Trasaction infromation to payu時,我注意到Request.Form的值爲空&這就是爲我創建問題的原因。此外,如果我不使用母版頁,代碼工作正常。它不能與母版頁一起工作。使用母版頁時Request.Form不工作
if (string.IsNullOrEmpty(ConfigurationManager.AppSettings("MERCHANT_KEY"))
|| string.IsNullOrEmpty(txnid1)
|| string.IsNullOrEmpty(Request.Form(amount.ClientID))
|| string.IsNullOrEmpty(Request.Form(firstName.ClientID))
|| string.IsNullOrEmpty(Request.Form(email.ClientID))
|| string.IsNullOrEmpty(Request.Form(phone.ClientID))
|| string.IsNullOrEmpty(Request.Form(productInfo.ClientID))
|| string.IsNullOrEmpty(Request.Form(surl.ClientID))
|| string.IsNullOrEmpty(Request.Form(furl.ClientID))) {
//error
frmError.Visible = true;
return;
} else {
string myAmount = amount.Text;
frmError.Visible = false;
hashVarsSeq = ConfigurationManager.AppSettings("hashSequence").Split('|');
// spliting hash sequence from config
hash_string = "";
foreach (string hash_var in hashVarsSeq) {
if (hash_var == "key") {
hash_string = hash_string + ConfigurationManager.AppSettings("MERCHANT_KEY");
hash_string = hash_string + Convert.ToString('|');
} else if (hash_var == "txnid") {
hash_string = hash_string + txnid1;
hash_string = hash_string + Convert.ToString('|');
} else if (hash_var == "amount") {
hash_string = hash_string + Convert.ToDecimal(Request.Form(hash_var)).ToString("g29");
hash_string = hash_string + Convert.ToString('|');
} else {
hash_string = hash_string + Convert.ToString((Request.Form(hash_var) != null ? Request.Form(hash_var) : ""));
// isset if else
hash_string = hash_string + Convert.ToString('|');
}
}
hash_string += ConfigurationManager.AppSettings("SALT");
// appending SALT
hash1 = Generatehash512(hash_string).ToLower();
//generating hash
// setting URL
action1 = ConfigurationManager.AppSettings("PAYU_BASE_URL") + "/_payment";
}
你在哪個事件中編碼? – hardkoded
@kblok它在按鈕上點擊事件 – SUN
只是爲了調試,你可以在那個事件中斷,並且在Inmmediate窗口'Request.Form.ToString()'中運行並共享結果? – hardkoded