Webservice WebMethod

  • Thread starter Thread starter Asim Qazi
  • Start date Start date
A

Asim Qazi

Hi All
i want to get the IP address of the client (calling application) in the
WebMethod of my Webservice,

in ASP i used to get this by this command
"Request.ServerVariables["REMOTE_ADDR"].ToString()"




Please Help.



aSIM.
 
Hi,

Asim said:
Hi All
i want to get the IP address of the client (calling application) in the
WebMethod of my Webservice,

in ASP i used to get this by this command
"Request.ServerVariables["REMOTE_ADDR"].ToString()"

HttpContext.Current.Request contains the HttpRequest instance, with all
details about the current request.

http://msdn2.microsoft.com/en-us/library/system.web.httprequest_members.aspx

I think that what you want is
HttpContext.Current.Request.UserHostAddress

Note that you have no guarantee that this is the IP address of the end
client, since there might be proxies in between.

HTH,
Laurent
 
Back
Top