2011-04-18 105 views
0

我在iam刪除特定用戶後使用response.redirect使網格填充最新值..但它給了我錯誤 lblError.Text =無法評估表達式,因爲代碼已優化或本地框架位於調用堆棧的頂部。Asp.net Response.Redirect

因爲這個錯誤IAM沒有得到確認刪除的任何幫助將不勝感激

代碼: - 如果(chk.Checked ==真){

     isDeleted=oFTE.DeleteUserRoleMapDetails(row.Cells[1].Text); 
         if (isDeleted == 0) 
         { 
          lblError.Visible = true; 
          lblError.ForeColor = System.Drawing.Color.Red; 
          lblError.Text = "User Role Map deletion failed."; 
         } 
         else if (isDeleted == 1) 
         { 
          lblError.Visible = true; 
          lblError.ForeColor = System.Drawing.Color.Red;         
          //Response.Redirect("userRoleMap.aspx"); 
          Session["Msg"] = "User Role Map deleted successfully."; 
          Response.Redirect("userRoleMap.aspx",false); 

          //lblError.Text = "User Role Map deleted successfully.";         
          break; 
         }              
        } 

        if (iRowCount == gridViewResults.Rows.Count) 
        { 
         lblError.Visible = true; 
         lblError.ForeColor = System.Drawing.Color.Red; 
         lblError.Text = "Please select a row to delete."; 
        } 
       } 
      } 
     } 
     catch (Exception ex) 
     { 
      lblError.Visible = true; 
      lblError.ForeColor = System.Drawing.Color.Red; 
      lblError.Text = ex.Message.ToString(); 
     }   
    }  
+2

你能發佈代碼> – Chandu 2011-04-18 16:19:24

+0

給我們展示一些代碼!你是否將帶有false的response.redirect作爲第二個參數來阻止進一步執行? response.redirect(url,false) – 2011-04-18 16:20:15

+0

這個問題已經被問很多,你是否已經檢查過這些:http://stackoverflow.com/search?q=Unable+to+evaluate+expression+because+the+code+is+優化+或+ a +原生+框架+ + + + + + + + + + + + + + + + + – 2011-04-18 16:21:37

回答

0
blError.Text=Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack. 

只當您在本機呼叫中暫停調試器時,顯示在本地/監視窗口中。這不是一個實際的錯誤,防止您的網頁加載。也許,問題在於你已經在你的代碼中設置了一個斷點,並且在你恢復執行之前請求已經從瀏覽器中超時了。

+0

沒有它幾乎沒有任何等待時間,甚至在刪除所有斷點後..它不給我確認 – deepti 2011-04-18 16:32:51

0

消息來自調試器。在沒有調試器的情況下運行應用程序以查看真正的錯誤。

相關問題