Bewerken

Delen via


WindowsIdentity.RunImpersonatedAsync Method

Definition

Overloads

RunImpersonatedAsync(SafeAccessTokenHandle, Func<Task>)

Runs the specified asynchronous action as the impersonated Windows identity.

RunImpersonatedAsync<T>(SafeAccessTokenHandle, Func<Task<T>>)

Runs the specified asynchronous action as the impersonated Windows identity.

RunImpersonatedAsync(SafeAccessTokenHandle, Func<Task>)

Runs the specified asynchronous action as the impersonated Windows identity.

public:
 static System::Threading::Tasks::Task ^ RunImpersonatedAsync(Microsoft::Win32::SafeHandles::SafeAccessTokenHandle ^ safeAccessTokenHandle, Func<System::Threading::Tasks::Task ^> ^ func);
public static System.Threading.Tasks.Task RunImpersonatedAsync (Microsoft.Win32.SafeHandles.SafeAccessTokenHandle safeAccessTokenHandle, Func<System.Threading.Tasks.Task> func);
static member RunImpersonatedAsync : Microsoft.Win32.SafeHandles.SafeAccessTokenHandle * Func<System.Threading.Tasks.Task> -> System.Threading.Tasks.Task
Public Shared Function RunImpersonatedAsync (safeAccessTokenHandle As SafeAccessTokenHandle, func As Func(Of Task)) As Task

Parameters

safeAccessTokenHandle
SafeAccessTokenHandle

The handle of the impersonated Windows identity.

func
Func<Task>

The function to run.

Returns

A task that represents the asynchronous operation of the provided Func<TResult>.

Applies to

RunImpersonatedAsync<T>(SafeAccessTokenHandle, Func<Task<T>>)

Runs the specified asynchronous action as the impersonated Windows identity.

public:
generic <typename T>
 static System::Threading::Tasks::Task<T> ^ RunImpersonatedAsync(Microsoft::Win32::SafeHandles::SafeAccessTokenHandle ^ safeAccessTokenHandle, Func<System::Threading::Tasks::Task<T> ^> ^ func);
public static System.Threading.Tasks.Task<T> RunImpersonatedAsync<T> (Microsoft.Win32.SafeHandles.SafeAccessTokenHandle safeAccessTokenHandle, Func<System.Threading.Tasks.Task<T>> func);
static member RunImpersonatedAsync : Microsoft.Win32.SafeHandles.SafeAccessTokenHandle * Func<System.Threading.Tasks.Task<'T>> -> System.Threading.Tasks.Task<'T>
Public Shared Function RunImpersonatedAsync(Of T) (safeAccessTokenHandle As SafeAccessTokenHandle, func As Func(Of Task(Of T))) As Task(Of T)

Type Parameters

T

The type of the object to return.

Parameters

safeAccessTokenHandle
SafeAccessTokenHandle

The handle of the impersonated Windows identity.

func
Func<Task<T>>

The function to run.

Returns

Task<T>

A task that represents the asynchronous operation of func.

Applies to