I'm playing with a new ASP.NET 5 MVC 6 app. So far, it's an empty, out-of-the-box application Visual Studio creates when ASP.NET 5 MVC project is selected.
In the Home controller action, I added the line to see if I'd get redirected to the generic error page i.e. ~/Views/Shared/Error.cshtml
throw new UnauthorizedAccessException("Test exception!");
When I run the project, all I get is an exception in my code but don't get redirected to the error page.
The following is the standard Startup.cs -- again, out-of-the-box code. I didn't make any changes yet.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseIISPlatformHandler();
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
Shouldn't I get redirected to the error page?