日期:2014-05-18  浏览次数:20817 次

Response.End 报错~~周末有人在不?
非常简单的使用:
Response.Write("<script LANGUAGE='javascript'>alert( Wrong!');history.go(-1);</script>");
Response.End();

catch到错误。。。。代码如下
E = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}


请问原因,如何解决~~~~

------解决方案--------------------
http://blog.csdn.net/skyaspnet/archive/2008/03/18/2194793.aspx
------解决方案--------------------
C# code

Response.Write("<script>alert( 'Wrong!');</script>");
Response.Write("<script>history.go(-1);</script>");

Response.End();

------解决方案--------------------
对于 Response.End,调用 ApplicationInstance.CompleteRequest 方法而不调用 Response.End,以便跳过 Application_EndRequest 事件的代码执行。 
对于 Response.Redirect,使用重载 Response.Redirect(String url, bool endResponse),对 endResponse 参数它传递 false以取消对 Response.End 的内部调用