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