问题描述
我们尝试使用示例 https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/浏览了样本和所有作品.我们无法在注销过程后将其重定向.另外,似乎帐户控制器不存在,但在_layout.chtml中被调用,这一定是新的东西.
We have tried using the samplehttps://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/Walked through the sample and all works.We can't get it to redirect after logout process. Also, it seems the account controller is not there but it is called in _layout.chtml this must be something new.
推荐答案
您可以在退出后通过设置 OnSignedOutCallbackRedirect
事件将用户重定向到另一个页面:
You can redirect user to another page after sign-out by setting the OnSignedOutCallbackRedirect
event :
- 在
Startup.cs
中使用System.Threading.Tasks添加;
-
在
OnSignedOutCallbackRedirect
事件中配置新的重定向URL:
- In
Startup.cs
addusing System.Threading.Tasks;
Config your new redirect url in
OnSignedOutCallbackRedirect
event :
services.Configure<OpenIdConnectOptions>(AzureADDefaults.OpenIdScheme, options =>
{
options.Authority = options.Authority + "/v2.0/";
options.TokenValidationParameters.ValidateIssuer = false;
options.Events.OnSignedOutCallbackRedirect = (context) =>
{
context.Response.Redirect("/Home/About");
context.HandleResponse();
return Task.CompletedTask;
};
});
这篇关于post_logout_redirect_uri ASP NET Core 2.2 AzureAD Razor类库RCL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!