Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Response.Redirect HTTP status code

Tags:

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?

like image 890
Vinz Avatar asked Nov 12 '09 16:11

Vinz


People also ask

What is the status code in response for redirection?

In HTTP, redirection is triggered by a server sending a special redirect response to a request. Redirect responses have status codes that start with 3 , and a Location header holding the URL to redirect to.

What is a 308 status code?

The HyperText Transfer Protocol (HTTP) 308 Permanent Redirect redirect status response code indicates that the resource requested has been definitively moved to the URL given by the Location headers.

What does 302 mean?

What is an HTTP 302? The 302 status code is a redirection message that occurs when a resource or page you're attempting to load has been temporarily moved to a different location. It's usually caused by the web server and doesn't impact the user experience, as the redirect happens automatically.

What is the difference between 302 and 307?

302 is temporary redirect, which is generated by the server whereas 307 is internal redirect response generated by the browser.


1 Answers

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 is has the RedirectPermanent method for that if needed.

like image 137
rick schott Avatar answered Sep 22 '22 07:09

rick schott