我在一个网站上工作,用户来这里提交一些信息。提交信息后,我尝试同时发送两封邮件 - 一封给我的销售团队,一封给我网站的访问者。
在发送邮件时,使用 Response.Redirect("http://www.targetsite.com/index.php")
重定向到另一个页面时出现以下错误:
Unable to evaluate expression because the code is optimized or a native frame is on top of call stack
谁能帮我解决这个问题?提前致谢。
最佳答案
您看到的消息实际上不是您在运行时看到的错误 - 通常,它在调试器中出现在 try-catch-finally block 的 catch 部分中间。您是在调试器中逐步执行代码,还是在应用程序在调试器外部运行时实际收到错误?
如果您试图确定真正发生了什么错误,我建议在 Response.Redirect 调用周围放置一个完整的 try-catch block 并检查此时触发的异常,例如
Try
Response.Redirect(http://www.targetsite.com/index.php")
Catch ex as Exception
' add your handling code here, using ex as the Exception placeholder variable
End Try
祝你好运!
关于c# - 无法评估表达式,因为代码已优化或 native 框架位于调用堆栈顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11439654/