Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法从Azure AD实例重定向默认登录页_C#_Asp.net_Azure Active Directory_Openid Connect - Fatal编程技术网

C# 无法从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

我们正在使用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);
            }

但它没有重定向到登录页面,请帮助我解决问题。

请提供web.config文件。在该质询调用之后,您是结束请求还是让它继续执行?您需要停止处理,以便重定向不会被覆盖。