Lab 11
Lab 11
In other words, your will discover different built-in middlewares available in the
Microsoft.AspNetCore.Diagnostics package, which is in the Microsoft.AspNetCore.App metapackage.
else
{
app.UseExceptionHandler("/Home/Error");
}
14. The ExceptionHandler middleware is used to configure a custom error handling page for the
Production environment. The middleware:
o Catches and logs exceptions.
o Re-executes the request in an alternate pipeline for the page or controller indicated.
The request isn't re-executed if the response has started.
In our care the request is re-executed in an alternate pipeline that point to /Home/Error.
15. Open HomeController.cs file, review the Error action and the model used to render the generic
Error view.
16. In the Views/Shared folder, open Error.cshtml view and review its content.
Note: you can change view content or localize it according to the application ui-culture.