From 3b88d2aa351eb76574a173ffa44b927bf9b0d8b7 Mon Sep 17 00:00:00 2001 From: Isaac Levin Date: Mon, 1 Jul 2019 16:42:02 -0400 Subject: [PATCH] added Error page to Server Blazor --- .../BlazorServerWeb-CSharp/Pages/Error.razor | 15 +++++++++++++++ .../content/BlazorServerWeb-CSharp/Startup.cs | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Pages/Error.razor diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Pages/Error.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Pages/Error.razor new file mode 100644 index 0000000000..7d2ae2a134 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Pages/Error.razor @@ -0,0 +1,15 @@ +@page "/error" + +

Error.

+

An error occurred while processing your request.

+ +

Development Mode

+

+ Swapping to the Development environment displays detailed information about the error that occurred. +

+

+ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +

diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Startup.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Startup.cs index 95677499c5..11f040ca9f 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Startup.cs @@ -148,7 +148,7 @@ namespace BlazorServerWeb_CSharp } else { - app.UseExceptionHandler("/Home/Error"); + app.UseExceptionHandler("/Error"); #if (RequiresHttps) // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts();