title: System.Web.HttpContextBase' does not contain a definition for 'Current' MVC 4 with Elmah Logging
body: <p>I have a C# ASP.NET MVC 4 project, which is using Elmah for catching any unhandled exceptions.  This works great in most situations.  </p>
  
  <p>However I've found that for a controller method that is called using a JQuery Ajax call, I can't get the current Context.  </p>
  
  <p>For example in my controller method that returns the JsonResult I have this test code;</p>
  
  <pre><code>try
  {
      throw new Exception("This is a test");
  }
  catch(Exception e)
  {
      Elmah.ErrorLog.GetDefault(HttpContext.Current).Log(new Elmah.Error(e));
  }
  </code></pre>
  
  <p>The </p>
  
  <blockquote>
    <p>HttpContext.Current</p>
  </blockquote>
  
  <p>is causing the following error;</p>
  
  <blockquote>
    <p>'System.Web.HttpContextBase' does not contain a definition for
    'Current' and no extension method 'Current' accepting a first argument
    of type 'System.Web.HttpContextBase' could be found (are you missing a
    using directive or an assembly reference?)</p>
  </blockquote>
  
  <p>How can I get around this problem ?</p>