我试图做一个HTTP 302重定向,但得到以下异常,而我在调试模式下运行。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();
长话短说,这个呼叫未冲洗的响应,而不是重定向。
我该如何得到这个工作?
您是否在调试模式下编译您的应用程序并像这样运行,或者您是否在发布模式下编译应用程序,并简单地将调试程序附加到进程? – Icarus
看看这里以及http://automagical.rationalmind.net/2010/03/08/response-redirect-and-302-and-301-status-codes/ –