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.

posted @ 2012-09-04 15:40  webglcn  阅读(386)  评论(0编辑  收藏  举报