title: Logging username with Elmah for WCF Webservices
body: <p>We are using the approach described <a href="https://stackoverflow.com/questions/895901/exception-logging-for-wcf-services-using-elmah/906494#906494">here</a> to log our webservice errors with Elmah. And this actually works, but sadly the username beeing logged is empty. </p>
  
  <p>We did some debugging and found, that when logging the error in the ErrorHandler the <code>HttpContext.Current.User</code> has the correct User set.</p>
  
  <p>We also tried:</p>
  
  <pre><code>HttpContext context = HttpContext.Current;
  ErrorLog.GetDefault(context).Log(new Error(pError, context));
  </code></pre>
  
  <p>and</p>
  
  <pre><code>ErrorLog.GetDefault(null).Log(new Error(pError));
  </code></pre>
  
  <p>Without success.</p>
  
  <p>Any ideas on how we can make Elmah log the username?</p>
  
  <p>On a sidenote, when logging the error directly within the Webservice, the username is logged as expected. But taking this approach is not very DRY.</p>