C# 无法从Azure AD实例重定向默认登录页
我们正在使用ASPX项目,需要将自定义登录更改为Azure AD登录页面 启动C# 无法从Azure AD实例重定向默认登录页,c#,asp.net,azure-active-directory,openid-connect,C#,Asp.net,Azure Active Directory,Openid Connect,我们正在使用ASPX项目,需要将自定义登录更改为Azure AD登录页面 启动 app.UseCookieAuthentication(new CookieAuthenticationOptions()); app.UseOpenIdConnectAuthentication( new OpenIdConnectAuthenticationOptions { // `Author
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);
}
但它没有重定向到登录页面,请帮助我解决问题。请提供web.config文件。在该质询调用之后,您是结束请求还是让它继续执行?您需要停止处理,以便重定向不会被覆盖。