R
Robert Phillips
I am suddenly getting this on a couple of Windows XP (.NET 1.1) machines in
my environment. The machines haven't change, and my code hasn't changed.
ExceptionType="System.ApplicationException"
Message="Access is denied."
TargetSite="IntPtr _GetCurrentToken()"
Source="mscorlib"
at System.Security.Principal.WindowsIdentity._GetCurrentToken()
at System.Security.Principal.WindowsIdentity.GetCurrent()
at System.AppDomain.GetThreadPrincipal()
at System.Threading.Thread.get_CurrentPrincipal()
at my code.....
my code is:
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
//exception happens here
string user = System.Threading.Thread.CurrentPrincipal.Identity.Name;
I originally thought it was a CAS issue, but SetPrincipalPolicy works which
means that the ControlPrincipal SecurityPermission is not the issue.
Reflector shows the _GetCurrentToken() method as
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern IntPtr _GetCurrentToken();
which i believe means it is an internal call into the CLR.
Does anyone have any thoughts on why this would be happening?
my environment. The machines haven't change, and my code hasn't changed.
ExceptionType="System.ApplicationException"
Message="Access is denied."
TargetSite="IntPtr _GetCurrentToken()"
Source="mscorlib"
at System.Security.Principal.WindowsIdentity._GetCurrentToken()
at System.Security.Principal.WindowsIdentity.GetCurrent()
at System.AppDomain.GetThreadPrincipal()
at System.Threading.Thread.get_CurrentPrincipal()
at my code.....
my code is:
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
//exception happens here
string user = System.Threading.Thread.CurrentPrincipal.Identity.Name;
I originally thought it was a CAS issue, but SetPrincipalPolicy works which
means that the ControlPrincipal SecurityPermission is not the issue.
Reflector shows the _GetCurrentToken() method as
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern IntPtr _GetCurrentToken();
which i believe means it is an internal call into the CLR.
Does anyone have any thoughts on why this would be happening?