无法评估表达式,因为代码已优化或本机框架位于调用堆栈之上

时间:2015-07-13 07:40:57

标签: c# asp.net

无法评估表达式,因为代码已优化或本机帧位于调用堆栈之上。关于这个话题,请帮助我。错误显示在RedirectAndPOST(this.Page,“strDTIurl”,ldata)中。

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        CommonProperties gCommonProperties = new CommonProperties();
        HttpContext _context = HttpContext.Current;
        gCommonProperties = (CommonProperties)_context.Items["Pay"];
        //ThreadStart childthreat = new ThreadStart();
        NameValueCollection ldata = new NameValueCollection();
        ThreadStart childthreat = new ThreadStart(childthreadcall);
        Thread child = new Thread(childthreat);
        child.Start();
        ldata.Add("transactionDetail", gCommonProperties.transactionDetail);
        ldata.Add("depositedBy", gCommonProperties.depositedBy);
        ldata.Add("contactNo", gCommonProperties.contactNo);
        ldata.Add("emailId", gCommonProperties.emailId);
        ldata.Add("district", gCommonProperties.district);
        ldata.Add("depositorAddress", gCommonProperties.depositorAddress);
        ldata.Add("deptName", gCommonProperties.deptName);
        ldata.Add("otherParameters", "(ReqID=" + gCommonProperties.ReqID.ToString() + "!~!CircleID=" + gCommonProperties.CircleName + "!~!UserCode=" + gCommonProperties.UserCode + "!~!redirect_url="+strRTNurl+")");
        Session["redirect"] = gCommonProperties.paymentConfirmPageURL;
        if (gCommonProperties.optionalParm != string.Empty)
        {
            Session["ReferId"] = gCommonProperties.optionalParm;
        }
        RedirectAndPOST(this.Page, "strDTIurl", ldata);
    }
}
 public static void RedirectAndPOST(Page page, string destinationUrl, NameValueCollection data)
{

    //Prepare the Posting form
    string strForm = PreparePOSTForm(destinationUrl, data);
    //Add a literal control the specified page holding 
    //the Post Form, this is to submit the Posting form with the request.
    page.Controls.Add(new LiteralControl(strForm));
}
private static String PreparePOSTForm(string url, NameValueCollection data)
{
    //Set a name for the form
    string formID = "PostForm";
    //Build the form using the specified data to be posted.
    StringBuilder strForm = new StringBuilder();
    strForm.Append("<form id=\"" + formID + "\" name=\"" +
                   formID + "\" action=\"" + url +
                   "\" method=\"POST\" >");//target=\"TheWindow\"

    foreach (string key in data)
    {
        strForm.Append("<input type=\"hidden\" name=\"" + key +
                       "\" value=\"" + data[key] + "\">");
    }

    strForm.Append("</form>");
    //Build the JavaScript which will do the Posting operation.
    StringBuilder strScript = new StringBuilder();
    strScript.Append("<script language='javascript'>");
    //strScript.Append("javascript:void window.open('','TheWindow','menubar= 1,scrollbars=1,width=600,height=400');");
    strScript.Append("var v" + formID + " = document." +
                     formID + ";");
    strScript.Append("v" + formID + ".submit();");
    strScript.Append("</script>");
    //Return the form and the script concatenated.
    //(The order is important, Form then JavaScript)
    return strForm.ToString() + strScript.ToString();
}

0 个答案:

没有答案