【发布时间】:2011-08-29 17:39:57
【问题描述】:
我正在尝试进行 HTTP 302 重定向,但在调试模式下运行时出现以下异常。
Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack
var response = HttpContext.Current.Response;
response.Clear();
response.Status = "302 Found";
response.AddHeader("Location", "http://google.com");
response.End();
response.Flush();
长话短说,这个调用不会刷新响应,也不会重定向。
我怎样才能让它工作?
【问题讨论】:
-
您是在调试模式下编译应用程序并像这样运行,还是在发布模式下编译应用程序并将调试器附加到进程?
标签: c# asp.net http redirect http-status-code-302