How to get Client'IP address?

 Posted by vishalneeraj-24503 on 12/19/2013 | Category: C# Interview questions | Views: 2381 | Points: 40

string client_IP_address = Dns.GetHostAddresses(System.Net.Dns.GetHostName()).GetValue(1).ToString();

We have to import System.Net Namespace.
GetHostAddresses returns IP address for the specified Host.
DNS stands for Domain Name Server, which provide Domain Name.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response