在我的 ASP.NET Web Forms 应用程序中,我将 ASP.NET Identity 2.2 用于会员系统。开发阶段按预期工作。用户通过身份验证并可以根据他们的角色访问网站的不同区域。
部署到 IIS 10 本地服务器后,身份验证被推翻。登录成功,但用户未进行身份验证。登录页面再次加载空白和新鲜。我知道登录是成功的,通过我在重定向之前创建的文字进行的一些测试。 这是登录方法:protected void LogIn(object sender, EventArgs e)
{
if (IsValid)
{
// Validate the user password
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var signinManager = Context.GetOwinContext().GetUserManager<ApplicationSignInManager>();
List<ApplicationUser> us = manager.Users.ToList();
foreach (var user in us)
{
textSuccess.Text += user.UserName + ": ";
foreach (var role in user.Roles)
{
textSuccess.Text += role.RoleId + ", ";
}
}
// This doen't count login failures towards account lockout
// To enable password failures to trigger lockout, change to shouldLockout: true
var result = signinManager.PasswordSignIn(Email.Text, Password.Text, true, shouldLockout: false);
switch (result)
{
case SignInStatus.Success:
panelSuccess.Visible = true;
IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
break;
case SignInStatus.LockedOut:
Response.Redirect("/Account/Lockout");
break;
case SignInStatus.RequiresVerification:
Response.Redirect(String.Format("/Account/TwoFactorAuthenticationSignIn?ReturnUrl={0}&RememberMe={1}",
Request.QueryString["ReturnUrl"],
RememberMe.Checked),
true);
break;
case SignInStatus.Failure:
default:
FailureText.Text = "Înregistrare eșuată";
ErrorMessage.Visible = true;
break;
}
}
}
我应该怎么办?集成管道的 OWIN 配置是否有问题?