Alex Rivera | Logout

How to find FQDN of local machine in C#/.NET ?

Asked 2009-04-29T23:08:16.190
98

How can you get the FQDN of a local machine in C#?

Edit
Report

1 Answer

65

A slight simplification of Miky D's code

    public static string GetLocalhostFqdn()
    {
        var ipProperties = IPGlobalProperties.GetIPGlobalProperties();
        return string.Format("{0}.{1}", ipProperties.HostName, ipProperties.DomainName);
    }
answered 2009-05-18T20:58:11.267

Your Answer