Exception returning: unable to evaluate expression because the code is optimized or a native frame is on top of the call stack

14,065

Try adding another parameter to Response.Redirect method. If you use Response.Redirect without second parameter, the exception ThreadAbortException occurs.

Response.Redirect("Default.aspx",false);

PRB: ThreadAbortException Occurs If You Use Response.End, Response.Redirect, or Server.Transfer

Share:
14,065
HelpASisterOut
Author by

HelpASisterOut

Program-err.

Updated on June 09, 2022

Comments

  • HelpASisterOut
    HelpASisterOut almost 2 years

    catch (Exception ex) is returning "unable to evaluate expression because the code is optimized or a native frame is on top of the call stack" in this code:

     cmsql = cnsql.CreateCommand(); 
     cmsql.CommandText = strsql;
     cmsql.CommandType = CommandType.Text; 
     reader = cmsql.ExecuteReader();
     if (reader.HasRows) {
     while (reader.Read()) { 
     Session["User_Email"] = reader["User_Email"].ToString().Trim(); 
     Session["User_Birthday"] = reader["User_birthday"].ToString().Trim(); }
     Response.Redirect("Default.aspx"); }
    

    What could be the reason?

  • gbbosmiya
    gbbosmiya almost 2 years
    try adding false but did not work for me