Reishabh Saxena

Reishabh Saxena

  • NA
  • 19
  • 2.5k

Get client IP address in a WCF Service hosted using HTTPS 443 bindings.

Jun 15 2012 6:10 AM

I want to get the client IP address in a WCF Service hosted using HTTPS 443 bindings. I am getting the Host IP address by below code.

private string GetIP()
        {
            OperationContext context = OperationContext.Current;
            MessageProperties prop = context.IncomingMessageProperties;
            RemoteEndpointMessageProperty endpoint =
                prop[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
            string ip = endpoint.Address;

            return ip ;

        }

Please help if you have any suggestions on this.

Thanks in advance.

Regards.

Reishabh


Answers (1)