Why do Thread.CurrentPrincipal.Identity and WindowsIdentity.GetCurrent() differ when impersonation is turned on?
问题 I enabled impersonation and windows authentiaction. <authentication mode="Windows" /> <identity impersonate="true" userName="name" password="passord"/> But Thread.CurrentPrincipal.Identity.Name returnes the name of authenticated user and WindowsIdentity.GetCurrent() returns impersonated identity. Shouldn't these identities be the same? And under wich credentials does the code run in this case? 回答1: As far as I can understand the Thread.CurrentPrincipal contains the information of conditions