Author: crandle | Posted on: 7/16/2008 5:02:54 PM | Views : 477

A web application calls a web service.  For examples sake, the webservice has a single function called WhatIsMyIP defined like this:
 [WebMethod]
 public string WhatisMyIP()
{
     return System.Web.HttpContext.Request.UserHostAddress;
}

 
If the web application resides on another server, the webservice returns the proper ip address.  However, if the web application resides on the SAME server under a different website - and each website is defined by a different IP address, then the call to Request.UserHostAddress returns the IP address of the WEBSERVICE site.
Question: Why is the behaviour different for this call depending on where the web application resides.  I would have thought that the Request.userHostAddress should return either the web applications assigned IP address or at least the ip address of the primary ip address on the server - which is different from the webservi ...

Go to the complete details ...