How to access HttpContext.Items from ApiController

  • Is HttpContext.Items still considered a sane place to exchange things between different parts of a request? In particular, HttpHandler is outside MVC like WIF extension points.

  • How can I access this dictionary from MVC4 ApiController? Without using static methods HttpContext.Current (I still want the block to be tested). A regular controller had an HttpContextBase / Wrapper that took it a bit for testing.

+3


source to share


1 answer


Use Request.Properties inside Web API Controller. When implementing ActionFilterAttribute it is filterContext.Request.Properties



+6


source







All Articles