// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.IO; using System.Net; using System.Text.RegularExpressions; namespace E { public class MainClass { public static string MyIp() { WebClient wc = new WebClient(); StreamReader sr = new StreamReader(wc.OpenRead("http://www.myip.dk/")); string html = sr.ReadToEnd(); return Regex.Matches(html, @"(?:Your IP address is: )(\d+\.\d+\.\d+\.\d+)(?:)")[0].Groups[1].Value; } public static void Main(string[] args) { Console.WriteLine(MyIp()); } } }