Thursday, June 23, 2011

Show External IP address using C#

I experimented a snippet to get my ISP provided IP address using whatismyip. Using tutorials or code snippets from links, the web request just returned a 404 error. After reading the whatismyip API again,they have changed their automation URL. Below is the code snippet.

  //previous URL present on most tutorials which is not working  
  //string whatIsMyIp = "";   
  //updated URL from whatismyip API  
  string whatIsMyIp = "";  
  WebClient wc = new WebClient();  
  UTF8Encoding utf8 = new UTF8Encoding();  
  string requestHtml = "";  
  requestHtml = utf8.GetString(wc.DownloadData(whatIsMyIp));


  1. Pretty great post. I simply stumbled upon your blog and wanted to say that I've really loved browsing your blog posts.
    After all I'll be subscribing to your rss feed and I hope you
    write again soon!

    my homepage: Hopfen vorbei zu diesen Kerlen (

  2. Hi,

    Thank you for such kind words. It gives me the motivation to write more articles provide education to the IT community.