此片段显示如何LogonUserIdentity
设置(使用反射器)
if ((this._wr is IIS7WorkerRequest) && (((this._context.NotificationContext.CurrentNotification == RequestNotification.AuthenticateRequest) && !this._context.NotificationContext.IsPostNotification) || (this._context.NotificationContext.CurrentNotification < RequestNotification.AuthenticateRequest)))
{
throw new InvalidOperationException(SR.GetString("Invalid_before_authentication"));
}
IntPtr userToken = this._wr.GetUserToken();
if (userToken != IntPtr.Zero)
{
string serverVariable = this._wr.GetServerVariable("LOGON_USER");
string str2 = this._wr.GetServerVariable("AUTH_TYPE");
bool isAuthenticated = !string.IsNullOrEmpty(serverVariable) || (!string.IsNullOrEmpty(str2) && !StringUtil.EqualsIgnoreCase(str2, "basic"));
this._logonUserIdentity = CreateWindowsIdentityWithAssert(userToken, (str2 == null) ? "" : str2, WindowsAccountType.Normal, isAuthenticated);
}
正如您所看到的,这已针对 IIS 7 进行了更改。我相信您正在使用Windows 身份验证 + 模拟,所以我会选择最后一个( WindowsIdentity.GetCurrent()
),我确信它是正在运行的身份请求。