Tahereh Farrokhi
Tahereh Farrokhi

Reputation: 601

WCF Data Service: How to get the IP Address of Request?

What is the best way to get the IP Address of Request in Wcf Data Service?

I am using .Net 4

Upvotes: 0

Views: 513

Answers (1)

Mentezza
Mentezza

Reputation: 637

Have you tried this?

OperationContext context = OperationContext.Current;

MessageProperties prop = context.IncomingMessageProperties; 

RemoteEndpointMessageProperty endpoint = prop[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty; 

string ip = endpoint.Address;

Upvotes: 1

Related Questions