asp.net - Why do Thread.CurrentPrincipal.Identity and WindowsIdentity.GetCurrent() differ when impersonation is turned on? -


i enabled impersonation , windows authentiaction.

<authentication mode="windows" /> <identity impersonate="true" username="name" password="passord"/> 

but thread.currentprincipal.identity.name returnes name of authenticated user , windowsidentity.getcurrent() returns impersonated identity.

shouldn't these identities same?

and under wich credentials code run in case?

as far can understand thread.currentprincipal contains information of conditions thread has been started with, including windowsidentity. that's why thread.currentprincipal.identity.name returns name of user started thread. contrary windowsidentity.getcurrent() returns windowsidentity object represents current windows user, has been changed via impersonation. i'm not 100% sure it, that's how think works.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -