0
HTTP headers, request messages can be intercepted before they are sent to the server. This can be done by implementing the IClientMessageInspector.BeforeSendRequestmethod:
-
-
-
- public class CustomEndpointBehavior : IEndpointBehavior
- {
-
-
-
-
-
- public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
- {
- clientRuntime.ClientMessageInspectors.Add(new ClientMessageInspector());
- }
-
-
-
-
-
- public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
- {
-
- }
-
-
-
-
-
-
- public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
- {
-
- }
-
-
-
-
-
- public void Validate(ServiceEndpoint endpoint)
- {
-
- }
This interception is a behavior or an extension of WCF endpoints, so one more method needs to be implemented to apply that behavior to the endpoint, the IEndpointBehavior.ApplyClientBehavior method:
-
-
-
- public class CustomEndpointBehavior : IEndpointBehavior
- {
-
-
-
-
-
- public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
- {
- clientRuntime.ClientMessageInspectors.Add(new ClientMessageInspector());
- }
-
-
-
-
-
- public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
- {
-
- }
-
-
-
-
-
- public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
- {
-
- }
-
-
-
-
- public void Validate(ServiceEndpoint endpoint)
- {
-
- }
- }
The last step is to add the new behavior to the WCF endpoint:
- Endpoint.EndpointBehaviors.Add(new CustomEndpointBehavior());

0
Mangesh,
I want to check and log incoming request coming from which Device/os i.e androids or IOS.
0
Subhash
i doubt if we can get them if u have checked then its better u are sending the value from the client (i.e. androids or IOS) itself
0
I have checked no option showing for os detection. can you tell me where i will get OS details Like Android or IOS.
0
U cab check for the uaeragent of the request