PageResult tells Razor Pages to render the associated Razor view as HTML and return a successful 200 response. The page handler selects this result; the view engine generates the response. section 15.1 section 15.4
Use PageResult when a handler should return the current page rather than redirect elsewhere:
- Return Page() from the PageModel; this helper creates a PageResult. section 15.6
- Returning void has the same rendering effect for a handler, because the associated Razor view is rendered implicitly. section 15.1 section 15.3
- Choose RedirectToPageResult instead when the browser should move to another Razor Page, such as after form submission. section 15.4.1
Returning the current Razor Page
After validating bound input and calling application logic, a page handler can finish with `return Page();`. Razor Pages then renders the associated view. A search handler can set its results and return the search page; a POST handler may instead redirect when the workflow moves to another page. section 15.3 section 15.4.1
Figure 15.3 A typical POST, REDIRECT, GET flow through a website. A user sends their shopping basket to a checkout page, which validates its contents and redirects to a payment page without the user’s having to change the URL manually.
Follow the POST-REDIRECT-GET flow to see why a handler returns PageResult when displaying the current page and RedirectToPageResult when continuing to another page. section 15.4.1
