如何解决无法从Azure AD实例重定向默认登录页面
我们正在使用ASPX项目,需要将自定义登录更改为Azure AD登录页面。
启动
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions
{
// `Authority` represents the identity platform endpoint - https://login.microsoftonline.com/common/v2.0.
// `Scope` describes the initial permissions that your app will need.
// See https://azure.microsoft.com/documentation/articles/active-directory-v2-scopes/.
ClientId = Globals.ClientId,Authority = Globals.Authority,//String.Format(CultureInfo.InvariantCulture,Globals.Authority,"common","/v2.0"),RedirectUri = Globals.RedirectUri,Scope = "openid profile",PostLogoutRedirectUri = Globals.PostLogoutRedirectUri,});
并且在aspx页面中做了以下更改,以重定向
if (!Request.IsAuthenticated)
{
HttpContext.Current.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "/" },OpenIdConnectAuthenticationDefaults.AuthenticationType);
}
但是它没有重定向到登录页面,请帮助我解决问题。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。