c# .net Adsense ADO.NET Linq Viruses/security asp.net MVC JQuery Angular-js Node-js SEO Java C++ SQL API Networking vb.net .Net Css JavaScript Generics c#.Net entity framework HTML Website host Website Construction Guide HTTP tutorial W3C tutorial Web Services JSON Psychology Ionic framework Angular ReactJS Python Computer Android
c# .net

Get you domain name from URL

| | ASP-NET , CSharp

It can be achieved by two methods, getting the domain hosted name using URL request Request.Url.Host and another by Uri. 

var url = "http://www.aljazeera.com/news/2016/07/dallas-police-suspect-affiliated-group-160708132417429.html";
            Uri myUri = new Uri(url);
            string host = myUri.Host;

 Output:

 

www.aljazeera.com