title: AsyncLocal Value is Null after being set from within Application_BeginRequest()
body: <p>In the following example, I am setting a value to an <code>AsyncLocal&lt;string&gt;</code> variable on my <code>HttpApplication</code> subclass (i.e. Global.asax) from within <code>Application_BeginRequest()</code>:</p>
  
  <pre><code>public class Global : System.Web.HttpApplication
  {
      public static AsyncLocal&lt;string&gt; AsyncLocalState = new AsyncLocal&lt;string&gt;();
  
      protected void Application_BeginRequest(object sender, EventArgs e)
      {
          AsyncLocalState.Value = HttpContext.Current.Request.Path;
      }
  
      protected void Application_AuthenticateRequest(object sender, EventArgs e)
      {
          var path = AsyncLocalState.Value;
      }
  
      protected void Application_EndRequest(object sender, EventArgs e)
      {
          var path = AsyncLocalState.Value;
      }
  }
  </code></pre>
  
  <p>Later on, I will attempt to access the value of this <code>AsyncLocal</code> variable from within a handler, such as an MVC action method, or even just a plain <code>IHttpHandler</code>.</p>
  
  <p>If I send a large enough request (e.g. a POST with more than 15KB of data -- the larger the request, the easier it is to observe), there is a very good chance that the value of <code>AsyncLocalState</code> is NULL when accessed from a handler <em>even though it was set on <code>BeginRequest</code></em>.</p>
  
  <p>This is reproducible from a brand-new ASP.NET project without any other libraries/modules/handlers loaded.</p>
  
  <p>Is this a bug? Or maybe I'm doing something wrong? Or is ASP.NET just too unstable for this?</p>
  
  <p>Addition note: the exact same behavior is observed if I instead use <code>CallContext.LogicalGetData</code>/<code>CallContext.LogicalSetData</code>.</p>
  
  <p>Platform: ASP.NET, .NET 4.6.2, on Windows 7</p>
  
  <p><strong>Update:</strong> After trying to dig around, I've found a lot of references to, but nothing authoritatively saying that the <code>ExecutionContext</code> <em>does not</em> flow between ASP.NET pipeline events (except when it does?). And both <code>AsyncLocal</code> and the logical call context are based on the <code>ExecutionContext</code>.</p>