I use something like this in my C# program:
Uri myuri = new Uri(toCheck);
...
...
if (myuri.Contains("string here"))
{
...
}
Is the Uri function trying to connect to the remote server for getting the hostname?
I ask for performance reasons..
How would be the best way for determinating the hostname of an address like “http://website.com/news/page.php?id=1&news=5
thanks 🙂
No, System.Uri is purely a string-handler, nothing there interacts with the network.
To get the HostName, use the GetLeftPart function and pass in the desired UriPartial value: