我需要永久重定向某些页面,并将用户重定向到新的URL。如何使用ASP.NET发送301永久重定向?
此代码只设置正确的标题。用户没有重定向。
public static void PermanentRedirect(this HttpResponse response, string newUrl)
{
response.Status = "301 Moved Permanently";
response.StatusCode = 301;
response.AddHeader("Location", newUrl);
}
如果我把:
Response.Redirect(newUrl);
末,302临时重定向进行。
我该如何301重定向用户?
相关问题:
我只是写了一个博客帖子:http://www.ko-sw.com/Blog/post/Permanent-Redirect-Using-ASPNET.aspx – Kerido 2010-02-22 21:19:12