【问题标题】:Button Authentication redirect not working按钮身份验证重定向不起作用
【发布时间】:2020-06-17 11:35:33
【问题描述】:

我正在为现有的网络表单应用程序实施 owin 身份验证。

我正在尝试让我的登录按钮将用户重定向到 microsoft 身份验证。

这是我在 LoginPage.aspx.cs 中的方法:

protected void LoginClicked(object sender, DirectEventArgs e)
       {
           if (!Request.IsAuthenticated)
           {
               HttpContext.Current.GetOwinContext().Authentication.Challenge(
               new AuthenticationProperties { RedirectUri = "/" },
               OpenIdConnectAuthenticationDefaults.AuthenticationType);
           }
       }

这是我在 LoginPage.aspx 中的按钮:

<ext:Button ID="LoginButton" runat="server" MarginSpec="40 0 0 0" Text="Log in with Microsoft" Scale="Large" AnchorHorizontal="100%" IDMode="Static" Cls="loginBtn">
                                <DirectEvents>
                                    <Click OnEvent="LoginClicked">
                                    </Click>
                                </DirectEvents>

但是,当我尝试单击该按钮时,我的网站只是刷新并且没有任何反应。我还尝试将身份验证挑战添加到 PageLoad。这行得通。但是按钮不起作用。有什么想法吗?

【问题讨论】:

    标签: asp.net authentication redirect extjs owin


    【解决方案1】:

    我修好了。我必须将AutoPostBack="True" 作为属性添加到我的按钮。

    【讨论】:

      猜你喜欢
      • 2016-11-04
      • 2013-11-15
      • 1970-01-01
      • 2015-03-17
      • 1970-01-01
      • 1970-01-01
      • 2020-06-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多