Thursday, April 27, 2006

ASP.NET 2.0 Magic: Asynchronous Web Pages

The classic and inherently synchronous processing model of ASP.NET pages is simply unfit. Asynchronous HTTP handlers have existed since ASP.NET 1.0, but the ASP.NET 2.0 provides an easy to use API for managing Asynchronous Web Pages. If we have an I/O incentive operation then the ASP.NET synchronous page is blocked waiting for the I/O to complete, which leaves the end user waiting. In case of asynchronous access the execution of page is divided in to two segment, one when the execution starts and the other when the task is done, these two task works in separate threads.

We can set an page to execute asynchronously by setting up the Async tag in the Page declaration of the ASP.NET Page.

<%@ Page Async="true" ... %>

This reference on the MSDN will be helpful in understanding it in details.