Hi thanks in advance to anyone who can help as i urgently need some, im trying to return Context.Request.UserHostAddress.ToString();
from my class file so that my web service can display it. But i am unsure how to do it.
I have been told about HttpRequest and HttpContext but have no idea how to use them.
How would i go about returning the IP address so that the web service can pick it up.

Inside the web Service
WebService1.asmx.cs

[WebMethod]
public MyMachine MachineData()
{
MyMachine machine = new MyMachine();
return machine;
}

And in the class file
MyMachine.cs

public class MyMachine
{
   private string machineName = System.Environment.MachineName;

        public string MachineName
        {
            get
            {
                return machineName;
            }
            set
            {
                machineName = value;
            }
        }
   //
   //Rest of the program
   //

}

The WebService shows Details about the users computer.

This resource at msdn.microsoft.com might be of some help in getting a bit more familiar with the methods you are trying to use.

I assume that you are using a browser front-end on your application or else you won't be able to utilize the httpRequest processes as they rely on browser input for their values.

Not really sure about the MachineName bit but I'm sure msdn.microsoft.com will have some info there for that as well.

Hope this helps :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.