diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Startup/AspNetStartup.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Startup/AspNetStartup.cs index fd35af089..76db38f15 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Startup/AspNetStartup.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Startup/AspNetStartup.cs @@ -42,7 +42,7 @@ public void ConfigureContainer(Registry registry) public void Configure(IApplicationBuilder app) { - app.UseDasErrorPages() + app.UseDasErrorPages(Environment) .UseUnauthorizedAccessExceptionHandler() .UseHttpsRedirection() .UseDasHsts() diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Startup/ErrorPagesStartup.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Startup/ErrorPagesStartup.cs index 490594c0c..30cde8dc1 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Startup/ErrorPagesStartup.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Startup/ErrorPagesStartup.cs @@ -1,23 +1,21 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.DependencyInjection; namespace SFA.DAS.EmployerCommitmentsV2.Web.Startup { public static class ErrorPagesStartup { - public static IApplicationBuilder UseDasErrorPages(this IApplicationBuilder app) + public static IApplicationBuilder UseDasErrorPages(this IApplicationBuilder app, IHostingEnvironment environment) { - var hostingEnvironment = app.ApplicationServices.GetService(); - if (hostingEnvironment.IsDevelopment()) + if (environment.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { - app.UseExceptionHandler("/error") - .UseStatusCodePagesWithReExecute("/error", "?statuscode={0}"); + app.UseExceptionHandler("/error"); + app.UseStatusCodePagesWithRedirects("~/error/?statuscode={0}"); } return app;