Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
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
