【发布时间】:2010-11-07 05:24:09
【问题描述】:
在像这样的 web.config 中使用 Windows 身份验证时如何注销?
<authentication mode="Windows" />
我已经尝试了以下失败。它会重定向,但不会注销用户。
void logoutButton_Click(object sender, EventArgs e) {
HttpContext.Current.Session.Clear();
HttpContext.Current.Session.Abandon();
ViewState.Clear();
FormsAuthentication.SignOut();
Response.Redirect("/");
}
背景信息:
我必须使用 Windows 身份验证,因为我需要使用 Active Directory 模拟身份来访问本地文件。而且我不能使用 Forms 身份验证来模拟,因为HttpContext.Current.User.Identity 不会是WindowsIdentity。
Impersonate using Forms Authentication
【问题讨论】:
-
看来通过表单身份验证冒充用户毕竟是可能的。见stackoverflow.com/a/11873754/359765
标签: asp.net windows-authentication logout