Request.Params返回null

时间:2014-08-13 08:15:49

标签: asp.net

我有一个来自银行回调的页面。

PaymentGatewayImplService bpService = new PaymentGatewayImplService();
                    result = bpService.bpPayRequest(TerminalId,
                        UserName,
                        Password,
                        pay.Id,
                        amount,
                        PayDate,
                        PayTime,
                        "",
                        "http://www.mysite/callback.aspx", 0);

String[] resultArray = result.Split(',');
                    if (resultArray[0] == "0")
                        ClientScript.RegisterStartupScript(typeof(Page), "ClientScript", "<script language='javascript' type='text/javascript'> postRefId('" + resultArray[1] + "');</script> ", false);

在javascript中

<script type="text/javascript">
 function postRefId(refIdValue) {
  var form = document.createElement("form");
  form.setAttribute("method", "POST");
  form.setAttribute("action", "<%= PgwSite %>");
  form.setAttribute("target", "_self");
  var hiddenField = document.createElement("input");
  hiddenField.setAttribute("name", "RefId");
  hiddenField.setAttribute("value", refIdValue);
  form.appendChild(hiddenField);
  document.body.appendChild(form);
  form.submit();
  document.body.removeChild(form);
    }
</script>

我想获得Request.Params。它在Form_Load中返回null。

var refId = Request.Params["RefId"];
var resCode = Request.Params["ResCode"];
var saleOrderId = Request.Params["SaleOrderId"];
var saleReferenceId = Request.Params["SaleReferenceId"];

但是当我从浏览器(FireBug)检查表格数据时,它有价值。

enter image description here

为什么在page_load中为params返回null?

0 个答案:

没有答案