How can you get the HttpMethod from the System.ServiceModel.Channels.RequestContext in WCF
c#, rest, wcf
Solution
The message should have a property of type `HttpRequestMessageProperty` (whose key is `HttpRequestMessageProperty.Name`. Try querying the request message from the context, then fetch that property from the message. The property has the HTTP verb used in the request.
Problem
How can you get the HttpMethod from the System.ServiceModel.Channels.RequestContext ? The HttpMethod property of the HostedHttpContext `(System.ServiceModel.Activation.HostedHttpContext)` is `Internal` Update - Explanation: I have created a `BasicAuthenticationInterceptor` (inherits RequestInterceptor) to use for Basic HTTP Authentication in my REST WCF service. In the `void ProcessRequest(ref RequestContext requestContext)` method, I need to check the HTTP Method (e.g. if it is a POST)