How can I use await/async in both a ashx and aspx files on the same site?
<p>I am trying to run an async task in the code-behind for my aspx page. I am using <code>Page.RegisterAsyncTask</code> and <code>Page.ExecuteRegisteredAsyncTasks</code> to run the async method. </p>

<p>However I get the error saying I need to add <code>&lt;httpRuntime targetFramework="4.5" /&gt;</code> to my webconfig file, but in adding that line, my use of async/await start throw an error in my ashx pages.</p>

<blockquote>
  <p>An asynchronous operation cannot be started at this time. Asynchronous operations may only be started within an asynchronous handler or module or during certain events in the Page lifecycle. If this exception occurred while executing a Page, ensure that the Page is marked &lt;%@ Page Async="true" %>. This exception may also indicate an attempt to call an "async void" method, which is generally unsupported within ASP.NET request processing. Instead, the asynchronous method should return a Task, and the caller should await it.</p>
</blockquote>

<p>Async/await work perfectly fine in the ashx page before adding <code>&lt;httpRuntime targetFramework="4.5" /&gt;</code> So how can I have async/await working in both kinds of files? </p>