Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / February 2005

Tip: Looking for answers? Try searching our database.

Client IP Address from Web Service Call

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Johnnie Norsworthy - 12 Feb 2005 01:19 GMT
I have created a web service that does some logging to a web database and
would like to include the client's IP address in the log information. How
can I get this information when a web service is called?

Thanks,

-Johnnie
Martin Kulov - 12 Feb 2005 21:04 GMT
Hi Johnnie,

Use Request.UserHostAddress to retrieve the IP of the calling client.

Regards,

Signature

Martin Kulov
http://www.codeattest.com

MCAD Charter Member
MCSD.NET Early Achiever
MCSD

> I have created a web service that does some logging to a web database and
> would like to include the client's IP address in the log information. How
[quoted text clipped - 3 lines]
>
> -Johnnie
Johnnie Norsworthy - 12 Feb 2005 22:19 GMT
> Hi Johnnie,
>
> Use Request.UserHostAddress to retrieve the IP of the calling client.

Martin,

Thank you for responding. One more thing please...

How should I create the System.Web.HttpRequest for Request.UserHostAddress
to be valid when my web service is called? My partial code is below.

Thanks,

Johnnie

using System.Web;
HttpRequest request = new HttpRequest( );  // parameters for my web service
to use???

ipAddress = request.UserHostAddress;
Johnnie Norsworthy - 12 Feb 2005 23:37 GMT
I think i have it now; I just do this from within the web method.
ipAddress = this.Context.Request.UserHostAddress;

Testing it now.

-Johnnie

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.