本文介绍了Response.Redirect HTTP 状态码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么 ASP/ASP.NET Response.Redirect 使用 HTTP-302 状态代码(临时移动"),尽管在大多数情况下 HTTP-301 状态代码(永久移动")更合适?
Why is it that ASP/ASP.NET Response.Redirect uses a HTTP-302 status code ("Moved Temporarily") even though in most cases a HTTP-301 status code ("Moved Permanently") would be more appropriate?
推荐答案状态为 301 的响应应该是可缓存的,我认为您不希望大多数 ASP/ASP.NET 重定向具有这种行为.
Responses with status 301 are supposed to be cacheable, and I don't think you want that behavior for most ASP/ASP.NET redirects.
ASP.NET 4.0 具有 RedirectPermanent 方法(如果需要).
ASP.NET 4.0 is has the RedirectPermanent method for that if needed.
更多推荐
Response.Redirect HTTP 状态码
发布评论