System.Net.SpnDictionary.GetCanonicalKey C# (CSharp) Method

GetCanonicalKey() private static method

private static GetCanonicalKey ( string key ) : string
key string
return string
        private static string GetCanonicalKey(string key)
        {
            if( key == null ) {
                throw new ArgumentNullException("key");
            }
            try {
                Uri uri = new Uri(key);
                key = uri.GetParts(UriComponents.Scheme | UriComponents.Host | UriComponents.Port | UriComponents.Path, UriFormat.SafeUnescaped);
                new WebPermission(NetworkAccess.Connect, new Uri(key)).Demand();
            }
            catch(UriFormatException e) {
                throw new ArgumentException(SR.GetString(SR.net_mustbeuri, "key"), "key", e);
            }
            return key;
        }
    }