Logging & Error Handling
Logging & Error Handling
Types of Errors:
- Debug
- Info
- Error
- Fatal
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute("default", "{controller=Home}/{action=Index}/{id?}");
});
}
-> With the following line in place, if there is a 404 error, the user is redirected to /Error/404. The
placeholder {0}, in "/Error/{0}" will automatically receive the http status code.
Eg:
app.UseStatusCodePagesWithRedirects("/Error/{0}");