diff --git a/aspnetcore/fundamentals/error-handling.md b/aspnetcore/fundamentals/error-handling.md index 4dc218d675..56f65c67bd 100644 --- a/aspnetcore/fundamentals/error-handling.md +++ b/aspnetcore/fundamentals/error-handling.md @@ -1,10 +1,10 @@ --- title: Handle errors in ASP.NET Core -author: ardalis +author: tdykstra description: Discover how to handle errors in ASP.NET Core apps. ms.author: tdykstra ms.custom: mvc -ms.date: 07/05/2018 +ms.date: 11/01/2018 uid: fundamentals/error-handling --- # Handle errors in ASP.NET Core @@ -113,17 +113,28 @@ The middleware supports several extension methods. One method takes a lambda exp [!code-csharp[](error-handling/samples/2.x/ErrorHandlingSample/Startup.cs?name=snippet_StatusCodePages)] -Another method takes a content type and format string: +An overload of `UseStatusCodePages` takes a content type and format string: ```csharp app.UseStatusCodePages("text/plain", "Status code page, status code: {0}"); ``` +### Redirect re-execute extension methods -There are also redirect and re-execute extension methods. The redirect method sends a *302 Found* status code to the client and redirects the client to the provided location URL template. The template may include a `{0}` placeholder for the status code. URLs starting with `~` have the base path prepended. A URL that doesn't start with `~` is used as is. +: + +* Sends a *302 - Found* status code to the client. +* Redirects the client to the location provided in the URL template. + +The template may include a `{0}` placeholder for the status code. The template must start with a forward slash (`/`). [!code-csharp[](error-handling/samples/2.x/ErrorHandlingSample/Startup.cs?name=snippet_StatusCodePagesWithRedirect)] -The re-execute method returns the original status code to the client and specifies that the response body should be generated by re-executing the request pipeline using an alternate path. This path may contain a `{0}` placeholder for the status code: +: + +* Returns the original status code to the client. +* Specifies that the response body should be generated by re-executing the request pipeline using an alternate path. + +The template may include a `{0}` placeholder for the status code. The template must start with a forward slash (`/`). ```csharp app.UseStatusCodePagesWithReExecute("/error/{0}"); @@ -140,7 +151,7 @@ if (statusCodePagesFeature != null) } ``` -If using a `UseStatusCodePages*` overload that points to an endpoint within the app, create an MVC view or Razor Page for the endpoint. For example, the [dotnet new](/dotnet/core/tools/dotnet-new) template for a Razor Pages app produces the following page and page model class: +To use a `UseStatusCodePages*` overload that points to an endpoint within the app, create an MVC view or Razor Page for the endpoint. For example, the [dotnet new](/dotnet/core/tools/dotnet-new) template for a Razor Pages app produces the following page and page model class: *Error.cshtml*: