From e54d2f94f88a4bccabe4fe62125b5315a678059e Mon Sep 17 00:00:00 2001 From: Simon <63975668+Simyon264@users.noreply.github.com> Date: Thu, 22 Aug 2024 01:53:24 +0200 Subject: [PATCH] Fix error page Fixes #37 --- ReplayBrowser/Pages/Error.razor | 2 +- ReplayBrowser/Startup.cs | 17 ++++++----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/ReplayBrowser/Pages/Error.razor b/ReplayBrowser/Pages/Error.razor index c89eaef..e24aca3 100644 --- a/ReplayBrowser/Pages/Error.razor +++ b/ReplayBrowser/Pages/Error.razor @@ -1,4 +1,4 @@ -@page "/Error" +@page "/error" @using System.Diagnostics @using Microsoft.AspNetCore.Components.Web diff --git a/ReplayBrowser/Startup.cs b/ReplayBrowser/Startup.cs index f04b136..1334973 100644 --- a/ReplayBrowser/Startup.cs +++ b/ReplayBrowser/Startup.cs @@ -1,10 +1,8 @@ using System.IdentityModel.Tokens.Jwt; using System.Net; -using System.Reflection; using System.Text.Json.Serialization; using Microsoft.AspNetCore.HttpOverrides; using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Caching.Memory; using Microsoft.IdentityModel.Protocols.OpenIdConnect; using OpenTelemetry.Metrics; using ReplayBrowser.Data; @@ -234,15 +232,12 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) return next(); }); - if (!env.IsDevelopment()) - { - app.UseExceptionHandler("/Error", createScopeForErrors: true); - // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. - app.UseHsts(); - } else - { - app.UseDeveloperExceptionPage(); - } +#if RELEASE + app.UseExceptionHandler("/error", createScopeForErrors: true); + app.UseHsts(); +#else + app.UseDeveloperExceptionPage(); +#endif app.UseHttpsRedirection();