Reputation: 1969
I am using the Azure AD B2C .Net core Microsoft.AspNetCore.Authentication.AzureADB2C.UI library (installed using NuGet) in a ASP.Net Core 2.2 MVC Web App.
I would like to be able to change the Error page, however it ignores any custom or Developer mode error pages.
Does anyone know how I can override the error handling and/or any other pages of this library?
This is the page (github) that gets returned for any Azure B2C errors. https://github.com/aspnet/AspNetCore/blob/master/src/Azure/AzureAD/Authentication.AzureADB2C.UI/src/Areas/AzureADB2C/Pages/Account/Error.cshtml
I have created a custom error page and have the following in my startup. Everything else uses either this custom page or the default developer exception page depending on mode.
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Account/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
Upvotes: 1
Views: 1733
Reputation: 31
Put this in your Startup.Configure() method:
app.UseRewriter(new RewriteOptions().Add(context =>
{
if (context.HttpContext.Request.Path == "/AzureADB2C/Account/SignedOut")
{
context.HttpContext.Response.Redirect("/Home/SignedOut");
}
}));
Redirect to whatever page you want.
Upvotes: 3