I have a simple .NET Core 2.0 project. Here is the Configure method:
public void Configure(IApplicationBuilder app, IHostingEnvironment environment)
{
app.UseStatusCodePagesWithReExecute("/error/{0}.html");
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller}/{action?}/{id?}",
defaults: new { controller = "Home", action = "Index" });
});
}
When I enter an invalid url, /error/404.html is displayed as expected, but the browser gets a 200 status code, instead of the expected 404 status.
What am I doing wrong? Can I not use a static html file as error page?