Overview

Developer Exception Page

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
		 app.UseDeveloperExceptionPage();
}

Custom Exception Handling Page

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
		app.UseExceptionHandler("/error");
}
[Route("/Error")]
public IActionResult Index()
{
    // Handle error here
}

Configuring Status Code Pages

app.UseStatusCodePages();
app.UseStatusCodePages(async context =>
{
    context.HttpContext.Response.ContentType = "text/plain";
    await context.HttpContext.Response.WriteAsync(
        "Status code page, status code: " + 
        context.HttpContext.Response.StatusCode);
});
app.UseStatusCodePages("text/plain", "Status code page, status code: {0}");