相关疑难解决方法(0)

ASP.NET Windows身份验证注销

如何在ASP.NET中使用Windows身份验证时注销,如此web.config?

<authentication mode="Windows" />
Run Code Online (Sandbox Code Playgroud)

我已经尝试过以下尝试失败了.它重定向,但不会注销用户.

void logoutButton_Click(object sender, EventArgs e) {
    HttpContext.Current.Session.Clear();
    HttpContext.Current.Session.Abandon();
    ViewState.Clear();
    FormsAuthentication.SignOut();
    Response.Redirect("/");
}
Run Code Online (Sandbox Code Playgroud)

背景资料:

我必须使用Windows身份验证,因为我需要使用Active Directory模拟身份以获取对本地文件的访问权限.而且我无法模仿使用Forms身份验证,因为它HttpContext.Current.User.Identity不会是一个WindowsIdentity. 使用表单身份验证进行模拟

asp.net windows-authentication logout

48
推荐指数
4
解决办法
8万
查看次数

标签 统计

asp.net ×1

logout ×1

windows-authentication ×1