identity

What happened to my Thread.CurrentPrincipal

This is not the IPrincipal you are looking for...

David Pine

4 minute read

Overview If you have ever done any .NET Framework development, you’ve probably seen the Thread class. You’re probably familiar with the Thread.CurrentPrincipal member. This member of the Thread class is defined as follows: public static IPrincipal CurrentPrincipal { [System.Security.SecuritySafeCritical] // auto-generated get { lock (CurrentThread) { var principal = (IPrincipal)CallContext.Principal; if (principal == null) { principal = GetDomain().GetThreadPrincipal(); CallContext.Principal = principal; } return principal; } } [System.Security.SecuritySafeCritical] // auto-generated [SecurityPermission(SecurityAction.