Adding Async=true to the page- no side effects noticed.

Posted by Michael Freidgeim on Geeks with Blogs See other posts from Geeks with Blogs or by Michael Freidgeim
Published on Sun, 30 Sep 2012 00:55:49 GMT Indexed on 2012/09/30 3:38 UTC
Read the original article Hit count: 436

Filed under:
Recently I needed to implement PageAsyncTask  in .Net 4 web forms application.

"A PageAsyncTask object must be registered to the page through the RegisterAsyncTask method. The page itself does not have to be processed asynchronously to execute asynchronous tasks. You can set the Async attribute to either true (as shown in the following code example) or false on the page directive and the asynchronous tasks will still be processed asynchronously:

<%@ Page Async="true" %>

When the Async attribute is set to false, the thread that executes the page will be blocked until all asynchronous tasks are complete."

I was worry about any site effects if I will set  Async=true on the existing page.
The only documented restrictions, that I found are that
@Async is not compatible with @AspCompat and Transaction attributes (from @ Page directive  MSDN article). In other words, 
Asynchronous pages do not work when the AspCompat attribute is set to true or the Transactionattribute is set to a value other than Disabled in the @ Page directive

From our tests we conclude, that adding Async=true to the page is quite safe, even if you don't always call Async tasks from the page 

© Geeks with Blogs or respective owner