PageAsyncTask Constructor (Func<CancellationToken, Task>)
Initializes a new instance of the PageAsyncTask class using an event handler that enables the task to be canceled.
Assembly: System.Web (in System.Web.dll)
Parameters
- handler
-
Type:
System.Func<CancellationToken, Task>
An event handler.
This constructor wraps a T:System.Web.CancellableTaskEventHandler delegate so that the PageAsyncTask object can integrate asynchronous code (based on Task objects) with the existing ASP.NET Web Forms asynchronous pages feature. ASP.NET will signal the CancellationToken object that is passed to a T:System.Web.CancellableTaskEventHandler delegate for cancellation based on the AsyncTimeout attribute set in the @ Page directive of the Web page. When the AsyncTimeout value has been reached, the CancellationToken object will be signaled. The CancellationToken parameter must be passed to any asynchronous APIs that are called by your implementation of the T:System.Web.CancellableTaskEventHandler class.
Available since 4.5