asp.net-mvccontrollerhttpcontexthttpapplication

Difference between HttpApplication.Context and Controller.HttpContext


In MSDN it says

HttpApplication.Context:

Gets HTTP-specific information about the current request.

Controller.HttpContext:

Gets HTTP-specific information about an individual HTTP request.

Whats the difference between them. Are they both the same?


Solution

  • Are they both the same?

    They are both the same. What is more, Controller.HttpContext is mockable (helpful for unittesting). They are point to the same data, but Controller.HttpContext provide more features like RouteData etc.