Response.Redirect HTTP 状态码

编程入门 行业动态 更新时间:2024-10-08 22:21:10
本文介绍了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 状态码

本文发布于:2023-10-10 18:04:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1479329.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:状态   Response   Redirect   HTTP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!