使用以下代码
context.Response.StatusCode = 301;
context.Response.Redirect(newUrl, true);
context.Response.End();
我可以在fiddler中看到它使用的是302而不是301.我应该在重定向呼叫后设置状态吗?
使用以下代码
context.Response.StatusCode = 301;
context.Response.Redirect(newUrl, true);
context.Response.End();
我可以在fiddler中看到它使用的是302而不是301.我应该在重定向呼叫后设置状态吗?
如果您使用的是ASP.NET4.0,则可以使用Response.RedirectPermanent,它将使用301而不是302.