/// <summary>
/// 建立请求,以表单HTML形式构造(默认)
/// </summary>
/// <param name="sParaTemp">请求参数数组</param>
/// <param name="strMethod">提交方式。两个值可选:post、get</param>
/// <param name="strButtonValue">确认按钮显示文字</param>
/// <returns>提交表单HTML文本</returns>
public static string BuildRequest(SortedDictionary<string, string> sParaTemp, string strMethod, string strButtonValue,int type)
{
//待请求参数数组
Dictionary<string, string> dicPara = new Dictionary<string, string>();
dicPara = BuildRequestPara(sParaTemp);
StringBuilder sbHtml = new StringBuilder();
if (type == 0)
{
sbHtml.Append("<form id='alipaysubmit' name='alipaysubmit' target='_blank' action='" + GATEWAY_NEW + "_input_charset=" + _input_charset + "' method='" + strMethod.ToLower().Trim() + "'>");
}
else {
sbHtml.Append("<form id='alipaysubmit' name='alipaysubmit' action='" + GATEWAY_NEW + "_input_charset=" + _input_charset + "' method='" + strMethod.ToLower().Trim() + "'>");
}
foreach (KeyValuePair<string, string> temp in dicPara)
{
sbHtml.Append("<input type='hidden' name='" + temp.Key + "' value='" + temp.Value + "'/>");
}
//submit按钮控件请不要含有name属性
sbHtml.Append("<input type='submit' value='" + strButtonValue + "' style='display:none;'></form>");
sbHtml.Append("<script>document.forms['alipaysubmit'].submit();</script>");
return sbHtml.ToString();
}
然后将这个方法输出的form表单放到前台的div中
divform.InnerHtml = sHtmlText;
前台是这样的
<div id="divform" runat="server">
</div>
完事之后就出现这个问题 了 请大家帮帮忙 此form表单是本地点击按钮获取到参数之后跳转到支付宝支付窗口的 点击提交之后就出现该问题了 大神求解!!!