Click here to Skip to main content
15,910,277 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
the problem is that when i am sending the request to server from local system without debugging, the code is running perfectly, but when i debug the code it is throwing the following exception
"Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack"
and not getting the required result.
How to resolve the issue


I am attaching the code:
C#
using (System.IO.StreamReader sr =new System.IO.StreamReader(objResponse.GetResponseStream()))
                {
                    TranResponse = sr.ReadToEnd();

                    string[] ErrorCheck = GetStringInBetween(TranResponse, "!", "!-", false, false);//This line will find Error Keyword in TranResponse

                    if (ErrorCheck[0]!= "ERROR")//This block will check for Error in TranResponce
                    {
                            // Merchant MUST map (update) the Payment ID received with the merchant Track Id in his database at this place.
                            string payid=TranResponse.Substring(0,TranResponse.IndexOf(":http"));
                            string payURL=TranResponse.Substring(TranResponse.IndexOf("http"));
                            // here redirecting the customer browser from ME site to Payment Gateway Page with the Payment ID
                            string TranRedirect=payURL+"?PaymentID="+payid;
                            //sql = "insert into onlinepay values('" + name + "','" + email + "','" + payid + "','" + TranTrackid + "','" + TranAmount + "','" + DateTime.Today.Date + "','N')";
                            //con.InsertData(sql);
                            sql = "insert into onlinepay values('" + registration + "','90002752','" + TranTrackid + "','" + payid + "','" + name + "','" + email + "','" + TranAmount + "','" + DateTime.Today.Date + "','Transaction in Progress','')";
                            con.InsertData(sql);
                            Response.Redirect(TranRedirect);
                    }
                    else
                    {


                        string TranErrorUrl = "http://test.conferencepacific.ac.in/FailedTRAN.aspx?Message=Transaction Failed&ResTrackId=" + TranTrackid + "&ResAmount=" + TranAmount + "&ResError=" + TranResponse;
                            // here redirecting the error page
                            Response.Redirect(TranErrorUrl);
                    }

                }
Posted

1 solution

Try this: Pass false as second parameter in Response.Redirect method.
C#
Response.Redirect(TranRedirect, false); 

C#
Response.Redirect(TranErrorUrl, false);


Check this link from MS Support:
http://support.microsoft.com/kb/312629/en-us[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900