【问题标题】:Exception returning: unable to evaluate expression because the code is optimized or a native frame is on top of the call stack异常返回:无法评估表达式,因为代码已优化或本机框架位于调用堆栈顶部
【发布时间】:2013-05-08 00:06:45
【问题描述】:

catch (Exception ex) 正在返回 “无法评估表达式,因为代码已优化或本机框架位于调用堆栈顶部” 在这段代码中:

 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"); }

可能是什么原因?

【问题讨论】:

    标签: c# asp.net database session


    【解决方案1】:

    尝试向Response.Redirect 方法添加另一个参数。如果使用不带第二个参数的 Response.Redirect,则会出现 ThreadAbortException 异常。

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

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

    【讨论】:

      猜你喜欢
      • 2012-07-11
      • 2012-10-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多