System.Web.HttpContext.Current vs. ControllerContext.HttpContext (almost the same)

Refer to http://stackoverflow.com/questions/785413/difference-between-httpcontext-current-and-controller-context-in-mvc-asp-net

The context provided by the controller (not the static HttpContext.Current) is mockable. If you're interested in unit-testing your code, it's generally far easier to create a mock ControllerContext and set it on the Controller than it is to go through HttpContext.Current. Otherwise ControllerContext.HttpContext points to the same data as HttpContext.Current.

原文地址:https://www.cnblogs.com/webglcn/p/2670491.html