What's my IP from C#


Please contribute by voting. Thanks!

Do you need to get public/external IP address from your C# program? Here's a little snippet that helps you:

string externalip = new WebClient().DownloadString("http://icanhazip.com");            
Console.WriteLine(externalip); //Writes your IP address and nothing more

If you do a GET-request the site only returns your public IP-address as text/plain. Other methods are available in this SO-thread

Article created: May 31 '18. Edited May 31 '18.

Your comment

You need to sign up / log in to comment this article


Created by Mika [4] May 31 '18

Share article

Do you know about


Write an article