How to get the Host Name of a computer?

 Posted by vishalneeraj-24503 on 12/18/2013 | Category: ASP.NET Interview questions | Views: 2222 | Points: 40
Answer:

We use GetHostName() method of System.Net.Dns class to get the Host name.

For Example:-
string strHostName = System.Net.Dns.GetHostName();


We can also import System.Net namespace.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response