C# Get Domain Name from URL – Programming, Pseudocode Example, C# Programming Example
C# Console General

C# Get Domain Name from URL

You can determine the host name of a Uri object with Uri.Host. That would be the host at http://asdf.site.csharp-console-examples.com/index.htm
If you only want to have csharp-console-examples.com, you can use this snippet.

C# Code:

 

1 Comment

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.