【发布时间】: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