Search code examples
c#.netweb-servicesfile-upload

How to get the client IP address from the request made to webservice


I have a webservice hosted in my IIS... I need to find out the clientIP address when the client use my service directly

like http://MyIpAddress/MyApplication/MyWebServiceClass.asmx

and is it possible to read file from the client machine? If so how can I do it?


Solution

  • Try calling

    Request.UserHostAddress
    

    HttpRequest.UserHostAddress Property

    With regards to accessing a file from the client, this would need be achieved by first uploading the file to the server.

    Checkout the following on uploading files to a web service:

    ASMX file upload

    Create a simple file transfer Web service with .NET