Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SecurityContext::Run Method (SecurityContext^, ContextCallback^, Object^)

 

Runs the specified method in the specified security context on the current thread.

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

public:
[SecurityCriticalAttribute]
static void Run(
	SecurityContext^ securityContext,
	ContextCallback^ callback,
	Object^ state
)

Parameters

securityContext
Type: System.Security::SecurityContext^

The security context to set.

callback
Type: System.Threading::ContextCallback^

The delegate that represents the method to run in the specified security context.

state
Type: System::Object^

The object to pass to the callback method.

Exception Condition
InvalidOperationException

securityContext is null.

-or-

securityContext was not acquired through a capture operation.

-or-

securityContext has already been used as the argument to a Run method call.

The security context for the current thread is returned to its previous state when the method call is complete.

The following code example shows how to use the Run method to execute a method in a specified security context.

No code example is currently available or this language may not be supported.

SecurityCriticalAttribute

requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.

.NET Framework
Available since 2.0
Return to top
Show:
© 2017 Microsoft