How do you access HttpContext.Items from ApiController

Go To StackoverFlow.com

4

  1. Is HttpContext.Items still considered a reasonable place to share things between different parts of a request? Particularly HttpHandler's outside of MVC, like WIF extensibility points.

  2. How do you access this dictionary from within MVC4's ApiController? Without using HttpContext.Current static methods (I still want it unit testable). The normal controller had HttpContextBase/Wrapper which abstracted it a bit for testing.

2012-04-04 19:47
by Craig Celeste
what do you want to share and between which elements - Aliostad 2012-04-05 16:44
I want to initialize a business component in request_start, use it in a WIF HttpHandler extensibility point and also in an WebApi controller action - Craig Celeste 2012-04-16 15:50


8

Use Request.Properties inside the Web API Controller. When implementing an ActionFilterAttribute it's filterContext.Request.Properties

2012-04-05 11:36
by Alexander Zeitler
Ads