I have to write redirects in my MVC global.asax file to accommodate an IIS 6 server. However, when I get to the old urls with extensions (.html), the server is not redirecting. Here is an example of my redirect code:
if (url.Contains("contact.html"))
{
Response.Clear();
Response.Status = "301 Moved Permanently";
Response.StatusCode = (int)HttpStatusCode.MovedPermanently;
Response.AddHeader("Location", "http://www.mysite.com/contact");
Response.End();
}
Why won't this work?
答案是由于需要将相关的http处理程序添加到IIS 6中。谢谢,史蒂文!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.