When you use AJAX-type asynchronous requests from your page to retrieve data from the database, you would want to use an
.ashx generic handler or maybe a web service to process that request, rather than a full-blooded
.aspx page. This will save you the overhead of the full page life cycle.
Accessing a database asynchronously from a generic handler is different from doing the same from a page. Let's see how this works.
Firstly, let's have a quick look at a synchronous generic handler. We'll then work that into its asynchronous counterpart using the asynchronous data access layer we just saw.
You'll find the code in the downloaded code bundle in the folder