UseStatusCodePagesWithReExecute conflict with Admin
In previous sites, we would use the app.UseStatusCodePagesWithReExecute("/error/{0}") to have a custom error page and handling for the website, however now that the admin and website are the same, this breaks some of Kentico's admin functionality. Anyone have any idea of how to have a custom error message only for the website but not touch any admin stuff?
Environment
- Xperience by Kentico version: 29.6.0
- .NET version: 8
- Execution environment: Local
Answers
I have it working with the following order:
var app = builder.Build();
app.InitKentico();
app.UseStaticFiles();
app.UseKentico();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseMiniProfiler();
}
app.UseStatusCodePagesWithReExecute("/error/{0}");
Maybe try make sure it is registered after InitKentico/UseKentico?
Thanks @liamgold
And, as a surprise to no one 😅 there is an example in the Kentico Community Portal.
To answer this question, you have to login first.