Wednesday 8 May 2013

How to find IPAddress of your system in asp.net using c#.

Hi friends, In this article i have described how to know your system IP Address in asp.net using c#.

Write the following in the page_load or whereevr you want.

string strMachineName = System.Net.Dns.GetHostName();
        string IPAddress = System.Net.Dns.GetHostAddresses(strMachineName).GetValue(1).ToString();
        Label1.Text = "Client machine name: " + strMachineName;

        Label2.Text = "Client Machine Ip Address :" +" "+ IPAddress ;


No comments:

Post a Comment

Note: only a member of this blog may post a comment.