[英]How to override / substitute Error Page handling when using the Microsoft.AspNetCore.Authentication.AzureADB2C.UI?
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. 我在ASP.Net Core 2.2 MVC Web App中使用Azure AD B2C .Net核心Microsoft.AspNetCore.Authentication.AzureADB2C.UI库(使用NuGet安装)。
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. 这是针对任何Azure B2C错误返回的页面(github)。 https://github.com/aspnet/AspNetCore/blob/master/src/Azure/AzureAD/Authentication.AzureADB2C.UI/src/Areas/AzureADB2C/Pages/Account/Error.cshtml
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();
}
Put this in your Startup.Configure() method: 把它放在你的Startup.Configure()方法中:
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. 重定向到您想要的任何页面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.