Encapsulates and propagates all security-related data for execution contexts transferred across threads. This class cannot be inherited.
See Also: SecurityContext Members
A System.Security.SecurityContext object captures all security-related information for a logical thread, including the information contained in the System.Security.Principal.WindowsIdentity and System.Threading.CompressedStack objects. This configuration allows the Windows identity and the security elements on the stack to be propagated automatically when the System.Security.SecurityContext is copied and transferred across asynchronous threads.
The common language runtime (CLR) is aware of impersonation operations performed using only managed code, not of impersonation performed outside of managed code, such as through platform invoke to unmanaged code or through direct calls to Win32 functions. Only managed System.Security.Principal.WindowsIdentity objects can flow across asynchronous points, unless the alwaysFlowImpersonationPolicy element has been set to true (<alwaysFlowImpersonationPolicy enabled="true"/>). Setting the alwaysFlowImpersonationPolicy element to true specifies that the Windows identity always flows across asynchronous points, regardless of how impersonation was performed. For more information about flowing unmanaged impersonation across asynchronous points, see <alwaysFlowImpersonationPolicy> Element.