title: UserContext becomes null after async call
body: <p>I have a web service call in my function <code>Verify</code>.
  The code is as follows:</p>
  <pre><code>public async Task&lt;ActionResult&gt; Index()
  {
      ....
      
      UserContext.LoginUser = null;
  
      if (!string.IsNullOrEmpty(etoken))
      {
          SSOLogin ssoLogin = new SSOLogin();
          LoginUser user = await ssoLogin.Verify(etoken);
          UserContext.LoginUser = user;
          if (UserContext.LoginUser == null)
              return RedirectToAction(&quot;UnAuthorized&quot;, &quot;Login&quot;);
          else
          {
              Session[&quot;authenticated&quot;] = true;
              userId = UserContext.LoginUser.UserId;
              domain = UserContext.LoginUser.Domain;
          }
      }
  }
  
  public async Task&lt;LoginUser&gt; Verify(string etoken)
  {
      string publicKey = &quot;xxx&quot;;
  
      LoginUser loginUser = null;
  
      WSVerifyAccessToken wsVerifyAccessToken = new WSVerifyAccessToken();
      string verifyResponse = await wsVerifyAccessToken.VerifyAccessToken(etoken); // Inside, this is a web service call
  
      if (!string.IsNullOrEmpty(verifyResponse))
      {
          /* Some processing here */
      }
  
  
      return loginUser;
  }
  </code></pre>
  <p>The problem is that, the UserContext becomes null after the <code>Verify</code> function</p>
  <pre><code>LoginUser user = await ssoLogin.Verify(etoken);
  </code></pre>
  <p>Hence when I assign</p>
  <pre><code>UserContext.LoginUser = user;
  </code></pre>
  <p>gives me the error <code>System.NullReferenceException: Object reference not set to an instance of an object.</code>.</p>
  <p>I tried to make the function to be synchronous</p>
  <pre><code>LoginUser user = await ssoLogin.Verify(etoken).Result;
  </code></pre>
  <p>but then the web service call will just hang there and never finishes.</p>
  <p>Any solution?</p>