title: Can Page_Load() Be Async
body: <p>Can a <code>Page_Load()</code> method be <code>async</code>?  I ask as if I have declared as such</p>
  
  <pre><code>protected void Page_Load()
  </code></pre>
  
  <p>Everything loads as it should.  If I have it declared as such</p>
  
  <pre><code>protected async void Page_Load()
  </code></pre>
  
  <p>the <code>Page_Load()</code> breakpoint is not hit, nor does the <code>catch()</code> block get hit.</p>
  
  <p>Now I am trying to set my <code>Page_Load()</code> method as <code>async</code> in order to have 3 different stored procedures execute to completion before the page is fully rendered.  If I do not have my <code>Page_Load()</code> method as <code>async</code> I get this compile error:</p>
  
  <blockquote>
    <p>The await operator can only be used with an async method. </p>
  </blockquote>
  
  <p>My code is as such.</p>
  
  <pre><code>private DataSet ds1 = new DataSet();
  private DataSet ds2 = new DataSet();
  private DataSet ds3 = new DataSet();
  
  protected async void Page_Load(object sender, EventArgs e)
  {
   if (!IsPostBack)
   {
      var task1 = GetStoreInfo();
      var task2 = GetSalespersonInfo();
      var task3 = GetManagerInfo();
      await System.Threading.Tasks.Task.WhenAll(task1, task2, task3);
      PopulateAll();
   }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>async System.Threading.Tasks.Task&lt;DataSet&gt; GetStoreInfo()
  {
    ds1 = RunStoredProcedureToReturnThisData();
    return ds1;
  }
  
  async System.Threading.Tasks.Task&lt;DataSet&gt; GetSalespersonInfo()
  {
    ds2 = RunStoredProcedureToReturnThisData();
    return ds2;
  }
  
  async System.Threading.Tasks.Task&lt;DataSet&gt; GetManagerInfo()
  {
    ds3 = RunStoredProcedureToReturnThisData();
    return ds3;
  }
  
  protected void PopulateAll()
  {
    //Bind the different returned datasets
  }
  </code></pre>