[Solved] Asynchronous operations are not allowed in this context [duplicate]


Page starting an asynchronous operation has to have the Async attribute set to true and an asynchronous operation can only be started on a page prior to PreRenderComplete event.

Have you set the Page.Async attribute to true, and are you starting the asynchronous operation before the PreRenderComplete event?

In general, you should avoid async void. Instead of async void, you should:

  1. Ensure your app is targeting 4.5 (or newer) and has httpRuntime.targetFramework set to 4.5 (or newer).
  2. Set Page.Async to true.
  3. Use PageAsyncTask with RegisterAsyncTask to register asynchronous work.

solved Asynchronous operations are not allowed in this context [duplicate]