How come the following URL is valid ?
var testURL = "http://" + "ggggggggg" +"/"
if(Uri.IsWellFormedUriString(testURL, UriKind.RelativeOrAbsolute))
{
// it comes here
}
How come the following URL is valid ?
var testURL = "http://" + "ggggggggg" +"/"
if(Uri.IsWellFormedUriString(testURL, UriKind.RelativeOrAbsolute))
{
// it comes here
}
Well-formed just means the string "looks like" a good URL. It has nothing to do with whether or not anything actually exists at that URL. There isn't even a requirement for a valid top level domain, or any top level domain at all. You only need valid host name, which can be simpler.
In this case, the URL http://ggggggggg/
is valid and well-formed, because ggggggg
is perfectly valid for the host portion of a URL. It would be perfectly legal to set up a web host on your local network with that name. If you really want to know if there is a web server at that address, then go ahead and send an http request, and wait for the response.