I’m trying to determine whether or not a given string is a valid url or not. And in my scenario, the url can have parameters:
I’ve tried the Uri.TryCreate method, Uri.TryCreate(url, UriKind.Absolute, null);
, but it accepts pretty much anything that has an http:// prefix, i.e. “http://xxx/” is OK.
I can’t use an HTTP request to check/ping the site for performance reasons.
Any suggestions?
It sounds like you want to call Uri.TryCreate(url, UriKind.Absolute, out result)
, then check that result.HostName
contains a .