Webservice WebMethod

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.
 
L

Laurent Bugnion

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top