0

I have WCF service hosted as windows service, I am trying to get clients (WPF client) Mac address at server end (WCF side). I have tried using following line of code but it gives me IP address of client that too in ::1 format. RemoteEndpointMessageProperty prop = OperationContext.Current.IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;

prop.Address is ::1

How can I get client Mac address so that I can differentiate among the client hitting my service. There could be scenarios where clients under same network may give me same IP address and that is reason I am looking for Mac address to identity client's call.

Joundill
  • 6,828
  • 12
  • 36
  • 50
NP_22
  • 49
  • 5

1 Answers1

0

Quick question: are you able to work with/modify the WPF code?

My thought is you could have the WPF client generate a unique code upon initialization, and include that along with each of its requests to the server.

  • I can but that would not go with the application architecture that I am working currently and may require more changes. However, if at all changes at WPF end is required, that means adding headers when I am establishing a connection with my server? Although, this is not what I am not really looking for, but to keep it as last resort, could you help in providing some sample code please. Thanks for the prompt check! – NP_22 Feb 10 '21 at 19:51
  • Hmm. MAC addresses are not part of IPv4/IPv6 packets, so I don't think you could get that from the request alone. – Quibfiddle Feb 10 '21 at 19:57
  • Okay, so again if at all I can not get this through, any suggestions that you can provide attaching client's identity when client is making request? – NP_22 Feb 10 '21 at 20:02
  • Here's an old post asking a similar question; you may be able to use the ServiceSecurityContext.Current.PrimaryIdentity property of the requester as their identity, but I have not tested this. link: [link](https://stackoverflow.com/questions/7312224/accessing-wcf-client-identity-on-service) – Quibfiddle Feb 10 '21 at 20:31
  • No luck. Just tried and as written in the post's comment, its null for me as well. Thanks for checking this out. I am also finding old posts and nowhere I can get a solution which meets my requirement!!! – NP_22 Feb 10 '21 at 20:41