WCF 4 Rest Getting IP of Request?

Hey, how do you get the IP address of the person making a request in something like the following:

    [ServiceContract]    
    [AspNetCompatibilityRequirements(RequirementsMode = 
    AspNetCompatibilityRequirementsMode.Required)]    
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]        
    public partial class UsersService
    {                          
        [WebInvoke(UriTemplate = "", Method = "PUT")]        
        public User AddNewUser(User newUser)
        {            
            // code goes here including GETTING AN IP??
        }

Thanks!

Answers


Inside AddNewUser use following snippet:

OperationContext context = OperationContext.Current;
MessageProperties messageProperties = context.IncomingMessageProperties;
RemoteEndpointMessageProperty endpointProperty =
  messageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;

RemoteEndpointMessageProperty instance offers Address and Port properties.


Need Your Help

How can I legally use LGPL javascript in a commercial web site?

javascript jquery gpl lgpl

My understanding is that with LGPL, can I link and use an LGPL library for commercial use, as long as I don't copy code?

ios: uitableview section header anchor to top of table

ios uitableview sectionheader

i'm trying to make a table with multiple section (like contact app)