IsWellFormedUriString() public static method

public static IsWellFormedUriString ( string uriString, UriKind uriKind ) : bool
uriString string
uriKind UriKind
return bool
Ejemplo n.º 1
0
        public void AddImage(string imageUrl)
        {
            if (!Uri.IsWellFormedUriString(imageUrl, UriKind.Absolute))
            {
                return;
            }

            string msgToAdd = string.Format(IMG_CONVO_FMT_IN, imageUrl);

            AddConvoMessage(msgToAdd);
        }
Ejemplo n.º 2
0
        public static bool IsValdiUrl(this string str, bool allowEmpty = true)
        {
            if (allowEmpty && string.IsNullOrEmpty(str))
            {
                return(true);
            }

            return(!string.IsNullOrWhiteSpace(str) && str.Contains(".") && str.IndexOf('.') < (str.Length - 1) && str.StartsWith("http", StringComparison.Ordinal) && Uri.IsWellFormedUriString(str, UriKind.Absolute) && Uri.TryCreate(str, UriKind.Absolute, out _));
        }