System.Web.HttpContextBase' does not contain a definition for 'Current' MVC 4 with Elmah Logging

Solution 1:

To get a reference to HttpContext.Current you need replace

HttpContext.Current

with

System.Web.HttpContext.Current

This is because Controller class defines a property named HttpContext that is defined as

public HttpContextBase HttpContext { get; }

HttpContext on Controller class returns HttpContextBase which does not have a Current property.

Hence you need to properly resolve the namespace here.