Wednesday, August 10, 2011

Get the IP address in a Web/Windows application

using System.Net;
private void button1_Click(object sender, EventArgs e)
{

string myHost = System.Net.Dns.GetHostName();
string myIp = System.Net.Dns.GetHostEntry(myHost).AddressList[0].ToString();

richTextBox1.Text = (myHost);
richTextBox2.Text = (myIp);

}

No comments:

Post a Comment

Implementing Service Locator (To Resolve Dependency)

using System; /// <summary> /// Summary description for Class1 /// </summary> public class serviceLocator {     public s...