Click here to Skip to main content
15,868,016 members
Articles / Web Development / CSS

Working with IP Addresses

Rate me:
Please Sign up or sign in to vote.
3.86/5 (12 votes)
12 Sep 20052 min read 77.9K   851   27   13
Using a web service to find the location of an IP address...

Image 1

Introduction

Imagine you have developed your own website, there are thousands of people visiting your website everyday. Do you want to know who your visitors are? In my article, I use a Web Service from www.webservicex.net to find the location of the IP addresses.

Using the Code

First, you have to create a new application in Microsoft Visual Studio .NET 2003. To use the Web Service from www.webservicex.net, you have to let your application connect to the service and use its functions. In the Solution Explorer, right-click on Reference in your project and select Add Web Reference.

Image 2

Then, the Add Web Reference window appears, type the address of your Web Service in the address bar. Our Web Service address is http://www.webservicex.net/geoipservice.asmx.

Image 3

After the Web Service is found, type the name of the Web Reference in the Web Reference name text box. Finally, click on Add Reference button to add the Web Reference into your application.

Now, let's code for our application!!!

First of all, if you want to find the location of an IP Address, you simply type the IP address in a textbox, and click the button, the details of the IP address will be shown in the label below.

VB
Private Sub btnOK_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles btnOK.Click
     Dim ws As New GeoIPService.GeoIPService
     lblInformation.Text = "Country: " & _
       ws.GetGeoIP(txtIPAddress.Text).CountryName
End Sub

When you type the IP address in the textbox and click the button, the information about the IP address will be shown in the label as in the picture below:

Image 4

Conclusion

I hope you will find some interesting things in this article. By using this Web Service, you know who visited your website by saving their IP address and using the web service to find their location.

If you feel interested in working with Web Services, let's take a look over at the website www.webservicex.net, there are more Web Services on this website that will be helpful for you!

License

This article has no explicit license attached to it, but may contain usage terms in the article text or the download files themselves. If in doubt, please contact the author via the discussion board below.

A list of licenses authors might use can be found here.


Written By
Software Developer (Senior)
Vietnam Vietnam
I've been working as a freelance iOS developer since the invention of the original iPhone. After numbers of projects, I gain more and more experience, get familiar with popular 3rd-party libraries which can save time and cost in the development.

With the experiences gained by working on projects, I proudly offer consultancy service which supports my customers to (1) get the best way to develop their apps; (2) start up iOS apps business professionally & effectively.

My day starts with the practices Japanese traditional Martial Arts: Kendo (http://bit.ly/18gJm5) & Iaido (http://bit.ly/atyeSB). Therefore, I always work with Samurai Spirit in the entire day, no FEAR and willing to take CHALLENGES!

If you need to get your iOS games or apps done, I'm available at oDesk!

Comments and Discussions

 
GeneralWere can i find the database Pin
vikas amin12-Sep-05 23:05
vikas amin12-Sep-05 23:05 
GeneralRe: Were can i find the database Pin
tom_dx13-Sep-05 2:05
tom_dx13-Sep-05 2:05 
GeneralRe: Were can i find the database Pin
Thang T.13-Sep-05 3:17
Thang T.13-Sep-05 3:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.