Is there a better/more accurate/stricter method/way to find out if a URL is properly formatted?
Using:
bool IsGoodUrl = Uri.IsWellForm
@Greg's solution is correct. However you can steel using URI and validate all protocols (scheme) that you want as valid.
public static bool Url(string p_strValue)
{
if (Uri.IsWellFormedUriString(p_strValue, UriKind.RelativeOrAbsolute))
{
Uri l_strUri = new Uri(p_strValue);
return (l_strUri.Scheme == Uri.UriSchemeHttp || l_strUri.Scheme == Uri.UriSchemeHttps);
}
else
{
return false;
}
}