I don't see a straight forward way of getting at this data. Off the top of my head, there are a lot of different ways to solve this within Global.asax. One way is to access the request and get the relevant path info from the global.asax begin request handler
and then store it in the HttpConfiguration properties bag (GlobalConfiguration.Configuration.Properties). Later in the pipeline, you can open up the configuration properties and retrieve this value.
While this is not meant to be exposed, you can access the http context via request.Properties["MS_HttpContext"], I wouldn't use this in production but for demo purposes it might work for you.
Dave Bettin
@dbettin
Marked as answer by mastoj on Mar 20, 2012 08:13 AM
davebettin
Member
313 Points
94 Posts
Re: Access to HttpContext.Current in a async MediaTypeFormatter
Mar 19, 2012 11:57 PM|LINK
I don't see a straight forward way of getting at this data. Off the top of my head, there are a lot of different ways to solve this within Global.asax. One way is to access the request and get the relevant path info from the global.asax begin request handler and then store it in the HttpConfiguration properties bag (GlobalConfiguration.Configuration.Properties). Later in the pipeline, you can open up the configuration properties and retrieve this value.
While this is not meant to be exposed, you can access the http context via request.Properties["MS_HttpContext"], I wouldn't use this in production but for demo purposes it might work for you.
@dbettin