Пример #1
0
        /// <summary>
        /// Takes a URL string and converts it into canonical form
        /// </summary>
        /// <param name="pszUrl">URL string</param>
        /// <param name="dwFlags">shlwapi_URL Enumeration. Flags that specify how the URL is converted to canonical form.</param>
        /// <returns>The converted URL</returns>
        public static string CannonializeURL(string pszUrl, ShlWapi_URL dwFlags)
        {
            StringBuilder _buffer = new StringBuilder(260);

            var s = _buffer.Capacity;
            var c = UrlCanonicalize(pszUrl, _buffer, ref s, dwFlags);

            if (c != 0)
            {
                _buffer.Capacity = s;
                c = UrlCanonicalize(pszUrl, _buffer, ref s, dwFlags);
            }

            return(_buffer.ToString());
        }
Пример #2
0
 public static extern int UrlCanonicalize(
     string pszUrl,
     StringBuilder pszCanonicalized,
     ref int pcchCanonicalized,
     ShlWapi_URL dwFlags
     );