Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
SuppressFlow Method

SecurityContext.SuppressFlow Method

Suppresses the flow of the security context across asynchronous threads.

Namespace: System.Security
Assembly: mscorlib (in mscorlib.dll)

public static AsyncFlowControl SuppressFlow ()
public static AsyncFlowControl SuppressFlow ()
public static function SuppressFlow () : AsyncFlowControl
Not applicable.

Return Value

An AsyncFlowControl structure for restoring the flow.

Use this method to suppress the flow of SecurityContext information on the current thread for asynchronous operations.

The common language runtime (CLR) is only aware of the impersonation operations performed using managed code. The CLR has no knowledge of impersonation performed outside of managed code, such as platform invokes to unmanaged code that does the impersonation, or through calls to Win32 functions. To flow identity across asynchronous points you must use the managed WindowsIdentity and WindowsImpersonationContext methods.

Use the Undo method on the returned AsyncFlowControl structure to return the SecurityContext object to its previous state.

This method is protected with a SecurityAction.LinkDemand for SecurityPermissionFlag.Infrastructure permission. A fully trusted component can call this method to suppress the flow of the SecurityContext information during asynchronous calls. When the flow is suppressed, the Capture method returns a null reference (Nothing in Visual Basic).

The following code example shows the use of the SuppressFlow method. This code example is part of a larger example provided for the SecurityContext class.

AsyncFlowControl aFC = SecurityContext.SuppressFlow();

AsyncFlowControl aFC = SecurityContext.SuppressFlow();

  • SecurityPermission  for operating with infrastructure code. Associated enumeration: SecurityPermissionFlag.Infrastructure Security action: LinkDemand.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2015 Microsoft