title: Session Access and Async Callbacks
body: <p>Ok, so I have a bunch of async web service calls that I make on the landing page of my website . I want to set the results of these calls to session so that I can use them later, but I can't because <code>HttpContext.Current</code> is null in the callback. Basically,  I want to do something like this:</p>
  
  <pre><code>public ActionResult Something()
  {
      GetLoans();              //each of these is async
      GetPartInfo();           //and sets its result to session
      GetOtherAsyncStuff();    //(or at least it needs to)
      //lots of other stuff
      Return View();
  }
  </code></pre>
  
  <p>Where <code>GetLoans()</code> looks like this:</p>
  
  <pre><code>public IAsyncResult GetLoans()
  {
      IAsyncResult _ar;
      GetLoansDelegate d_Loans = new GetLoansDelegate(GetLoansAsync);
      _ar = d_Loans.BeginInvoke(parameter1,parameter2, GetLoansCallback, new object()); //new object() is just a placeholder for the real parameters im putting there
      return _ar;
  }
  </code></pre>
  
  <p>Which asynchronously invokes <code>GetLoansAsync</code>, whose callback is <code>GetLoansCallback()</code>, shown here:</p>
  
  <pre><code>private void GetLoansCallback(IAsyncResult ar)
  {
      AsyncResult result = (AsyncResult)ar;
      GetLoansDelegate caller = (GetLoansDelegate)result.AsyncDelegate;
      List&lt;Loan&gt; loans = caller.EndInvoke(ar);
  
      Session["Loans"] = loans;   //this call blows up, since HttpContext.Current is null
  }
  </code></pre>
  
  <p>I can't implement a custom session provider, so I have to stick with what I've got there. So as it stands, I can't set anything to session in my async callback. Is there a way to get around this? </p>