Response.Redirect HTTP 状态码 [英] Response.Redirect HTTP status code

查看:44
本文介绍了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 状态码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆