Another general case where one might receive this exception involves mocking classes during unit testing. Regardless of the mocking framework being used, you must ensure that all appropriate levels of the class hierarchy are properly mocked. In particular, all properties of HttpContext which are referenced by the code under test must be mocked.
See "NullReferenceException thrown when testing custom AuthorizationAttributeNullReferenceException thrown when testing custom AuthorizationAttribute" for a somewhat verbose example.