Access HttpContext inside WCF RequestInterceptor ProcessRequest method
I have create a WCF service using the WCF REST stater kit. I am using a RequestInterceptor to do authentication(API Key validation).Inside of the RequestInterceptor(ProcessRequest method) I want to get access to the HttpContext of the request.I have to store several things in the HttpContext. Can somebody help me how to access the HttpContext inside RequestInterceptor. Although Httpcontext is accessible under 开发者_JAVA技巧service.
This might help, you dont get the HttpContext but you can get to the headers and other aspects that will get you the same data.
var prop = (HttpRequestMessageProperty)requestContext.RequestMessage.Properties[HttpRequestMessageProperty.Name];
var queryString = requestContext.RequestMessage.Headers.To.AbsolutePath;
var authAccessToken = prop.Headers["Authorization"];
精彩评论