0

I am Passing Parameters to ICICI Payment Gateway but I am getting below error in exception:

Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack

Below is my C# code:

HttpResponse response = HttpContext.Current.Response;
response.Clear();

StringBuilder s = new StringBuilder();
s.Append("<html>");
s.AppendFormat("<body onload='document.forms[\"form\"].submit()'>");
s.AppendFormat("<form name='form' action='{0}' method='post'>", "http://payment.xyz.com/Test.aspx");

s.AppendFormat("<input type='hidden' name='userID' value='" + RegId +" ' />");
s.AppendFormat("<input type='hidden' name='Amount' value='" + lbl_amount.Text + "' />");
s.Append("</form></body></html>");
response.Write(s.ToString());
response.End();

Page is redirecting also into http://payment.xyz.com/Test.aspx and also getting error in this URL:

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Mr doubt
  • 51
  • 1
  • 10
  • 42
  • http://stackoverflow.com/questions/2041482/unable-to-evaluate-expression-because-the-code-is-optimized-or-a-native-frame-is – DVK Aug 03 '16 at 13:47
  • I checked your above URL but not getting any solution, please check my code. @DVK – Mr doubt Aug 03 '16 at 13:49
  • You are calling Response.End, which can cause the same type of symptoms. Also, you might need to provide some additional code for context (such as a sample of the full method that creates the form). – DVK Aug 03 '16 at 13:52
  • Please can you update your answer. @DVK – Mr doubt Aug 03 '16 at 13:54

0 Answers0