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

查看:324
本文介绍了Response.Redirect的HTTP状态code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么说ASP / ASP.NET Response.Redirect的使用HTTP-302状态code(暂时移动),即使在大多数情况下,HTTP-301状态code(永久移动 )会更合适?

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是如果需要有永久重定向该方法。

ASP.NET 4.0 is has the RedirectPermanent method for that if needed.

这篇关于Response.Redirect的HTTP状态code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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