![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Uri.CheckHostName(String) Method in C#
The Uri.CheckHostName() method in C# is used to determine whether the specified hostname is a valid DNS name.
Syntax
Following is the syntax −
public static UriHostNameType CheckHostName (string host_name);
Example
Let us now see an example to implement the Uri.CheckHostName() method −
using System; public class Demo { public static void Main(){ string strURI = "http://localhost"; Console.WriteLine("URI = "+strURI); UriHostNameType res = Uri.CheckHostName(strURI); Console.WriteLine("Host type = "+res); } }
Output
This will produce the following output −
URI = http://localhost Host type = Unknown
Example
Let us now see another example to implement the Uri.CheckHostName() method −
using System; public class Demo { public static void Main(){ string strURI = "www.tutorialspoint.com"; Console.WriteLine("URI = "+strURI); UriHostNameType res = Uri.CheckHostName(strURI); Console.WriteLine("Host type = "+res); } }
Output
This will produce the following output −
URI = www.tutorialspoint.com Host type = Dns
Advertisements