Page.RegisterAsyncTask Method (PageAsyncTask)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Registers a new asynchronous task with the page.

Namespace:   System.Web.UI
Assembly:  System.Web (in System.Web.dll)

member RegisterAsyncTask : 
        task:PageAsyncTask -> unit


Type: System.Web.UI.PageAsyncTask

A PageAsyncTask that defines the asynchronous task.

Exception Condition

The asynchronous task is null.

Define an asynchronous task using the PageAsyncTask class. When the task is defined, use the RegisterAsyncTask method to register the task with the page. After registering the task, invoke the ExecuteRegisteredAsyncTasks method to begin the asynchronous task.

The RegisterAsyncTask method can be used with both synchronous and asynchronous pages.

The following code example demonstrates the use of the AsyncTimeout property with the ExecuteRegisteredAsyncTasks and RegisterAsyncTask methods. Note the use of beginning, ending, and time-out handlers. In the example, an artificial delay is introduced to demonstrate the situation of an asynchronous task exceeding the allotted time for the task as specified in the AsyncTimeout property. In a real-world scenario, an asynchronous task could be used to perform database calls or image generation, for example, and the time-out handler provides graceful degradation if the task is not performed in a specified amount of time.

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

.NET Framework
Available since 2.0
Return to top