So I have a URI with a DNS alias, and I need to dynamically replace the alias with the actual machine. I started out with this:var builder = new UriBuilder(http://server-alias/path/to/resource);builder.Host = Dns.GetHostEntry(builder.Host).HostName;return builder.Uri; // http://server1.mydomain.net/path/to/resourceHowever, what I need is the URI with just the machine name, http://server1/path/to/resource. Of course I can use this, but string manipulation seems seems a bit kludgey:builder.Host = Dns.GetHostEntry(builder.Host).HostName.Split(new[] { '.' }, 2)[0];Is there a better way to get just the machine name from a DNS alias, without the domain? 
Resolve (domainless) machine name from DNS alias
c#;.net;url