title: ASP.NET CorrelationManager.ActivityId is empty
body: <p>I'm using NLog version 4.5.2, and I'm trying to use the <code>${activityid}</code> LayoutRenderer.
  I've followed the instructions at the NLog tutorial page: <a href="https://github.com/NLog/NLog/wiki/Trace-Activity-Id-Layout-Renderer" rel="noreferrer">NLog ActivityId</a></p>
  
  <p>As mentioned, I instantiated the <code>System.Diagnostics.Trace.CorrelationManager.ActivityId</code> by setting: <code>System.Diagnostics.Trace.CorrelationManager.ActivityId = Guid.NewGuid()</code> at the <code>Application_BeginRequest</code> event.</p>
  
  <p>Loally it worked great, but after I deployed it to a different server, I've noticed that the <code>${activityid}</code> isn't written.</p>
  
  <p>After some searching and debugging, I came across a weird situation.
  At the line of code in the <code>Application_BeginRequest</code> event, the <code>ActivityId</code> is set just right, but then when the real http post method occurs, I see that the <code>ActivityId</code> has the value of an empty guid (0000-00...).</p>
  
  <p>One thing I've noticed it, that the ActivityId is emtpy when sending POST request with data on the request (Again - only to the remote server).</p>
  
  <p>Can someone help me out with this issue?
  I can't seem to figure it out.</p>
  
  <p><strong>UPDATE #1:</strong></p>
  
  <p>I checked the same version of my application on Windows Server 2012 and it worked (My problem is currently on Windows Server 2008 R2).</p>
  
  <p><strong>UPDATE #2:</strong></p>
  
  <p>I couldn't find a solution for why this is happening only on Windows Server 2008 R2 and not locally (Windows 7) or on Windows Server 2012, but I managed to find a workaround/different solution.</p>
  
  <p>Instead of instantiating the <code>System.Diagnostics.Trace.CorrelationManager.ActivityId</code> in the Global.asax.cs class, at the <code>Application_BeginRequest</code> event, I created a new <code>DelegatingHandler</code> and instantiated the <code>System.Diagnostics.Trace.CorrelationManager.ActivityId</code> at the SendAsync method of the <code>DelegatingHandler</code></p>
  
  <p>In this scenario, the <code>ActivityId</code> is generated for each http request (as same) but now it isn't empty when the request is a HTTP POST request with data inside.</p>
  
  <p>An example is found here <a href="https://github.com/jonwagner/EventSourceProxy/issues/24" rel="noreferrer">DelegatingHandler Example</a></p>