liveBook · Manning

302 found

As explained in ASP.NET Core in Action, 3e

The 302 status code is an HTTP response status that temporarily directs a client to retrieve a resource from another location.

A 302 Found response temporarily sends the client to another location. In ASP.NET, the browser reads the generated URL from the Location header and requests the new page. section 6.4.2

RedirectToRoute() targets a named endpoint and usually returns 302. Results.Redirect() targets an arbitrary URL, including an external destination. section 6.4.2

Choose the redirect behavior deliberately:

  • Use 302 when the redirect is temporary and the request method does not need to be preserved. section 6.4.2
  • Use 307 when the redirect is temporary but the request method must be preserved. section 6.4.2
  • Avoid treating 301 and 308 as casual alternatives: browsers may stop requesting the original URL. section 6.4.2
  • For error pages, a redirect creates a second request and loses the original status code; re-execution preserves it. section 15.5

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains Location headers, browser follow-up requests, status alternatives, and error-page tradeoffs without covering HTTP internals.
Examples
Demonstrates named endpoint redirection and converting a 404 response into a second request for an error page.
What it assumes
Assumes familiarity with endpoints, routes, browsers, response headers, and ASP.NET middleware.
What you can do after
Apply it via RedirectToRoute(), Results.Redirect(), or status-code middleware while choosing method preservation and permanence intentionally.
How it connects
Connects HTTP redirects with URL routing, Location headers, minimal APIs, Razor Pages, and status-code middleware.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.