How to run an ASP.NET page asynchronously only under certain conditions?

I have an ASP.NET page which usually runs quickly, but sometimes has to call an external service which can take a few seconds to respond. So, most of the time, I want this page to run as usual, synchronously, but run asynchronously when it needs to call the service.I'm guessing I can just set \[code\]<%@ Page Async="true" ... %>\[/code\] and only run the asynchronous code (setting the event handlers, etc) when needed, in the code-behind. If I don't set up the asynchronous event handlers, the page will run synchronously, as normal, with no performance hit or other issues.Is that approach regarded as perfectly fine, or are there issues with that?
 
Back
Top