當前位置: 首頁>>代碼示例>>C#>>正文


C# Uri.FullAuthority方法代碼示例

本文整理匯總了C#中System.Uri.FullAuthority方法的典型用法代碼示例。如果您正苦於以下問題:C# Uri.FullAuthority方法的具體用法?C# Uri.FullAuthority怎麽用?C# Uri.FullAuthority使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Uri的用法示例。


在下文中一共展示了Uri.FullAuthority方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ArgumentNullException

        public HttpBearerChallenge this[Uri url]
        {
            get
            {
                if ( url == null )
                    throw new ArgumentNullException( "url" );

                HttpBearerChallenge value = null;

                lock ( _cacheLock )
                {
                    _cache.TryGetValue( url.FullAuthority(), out value );
                }

                return value;
            }
            set
            {
                if ( url == null )
                    throw new ArgumentNullException( "url" );

                if ( value != null && string.Compare( url.FullAuthority(), value.SourceAuthority, StringComparison.OrdinalIgnoreCase ) != 0 )
                    throw new ArgumentException( "Source URL and Challenge URL do not match" );

                lock ( _cacheLock )
                {
                    if ( value == null )
                        _cache.Remove( url.FullAuthority() );
                    else
                        _cache[url.FullAuthority()] = value;
                }
            }
        }
開發者ID:theadriangreen,項目名稱:azure-sdk-for-net,代碼行數:33,代碼來源:HttpBearerChallengeCache.cs

示例2: ObjectIdentifier

        protected ObjectIdentifier(string collection, string identifier)
        {
            if (string.IsNullOrEmpty(collection))
                throw new ArgumentNullException("collection");

            if (string.IsNullOrEmpty(identifier))
                throw new ArgumentNullException("identifier");

            Uri baseUri = new Uri(identifier, UriKind.Absolute);

            // We expect and identifier with either 3 or 4 segments: host + collection + name [+ version]
            if (baseUri.Segments.Length != 3 && baseUri.Segments.Length != 4)
                throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, 
                    "Invalid SecretIdentifier URL: {0}. Bad number of segments: {1}", identifier, baseUri.Segments.Length));

            if (!string.Equals(baseUri.Segments[1], collection + "/"))
                throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, 
                    "Invalid SecretIdentifier URL: {0}. segment [1] should be '{1}/', found '{2}'", identifier, collection, baseUri.Segments[1]));

            _name = baseUri.Segments[2].Substring(0, baseUri.Segments[2].Length).TrimEnd('/');

            if (baseUri.Segments.Length == 4)
                _version = baseUri.Segments[3].Substring(0, baseUri.Segments[3].Length).TrimEnd('/');

            _vault = string.Format(CultureInfo.InvariantCulture, "{0}://{1}", baseUri.Scheme, baseUri.FullAuthority());

            _baseIdentifier = string.Format(CultureInfo.InvariantCulture, "{0}/{1}/{2}", _vault, collection, _name);
            _identifier = string.IsNullOrEmpty(_version) ? _name : string.Format(CultureInfo.InvariantCulture, "{0}/{1}", _name, _version);
            _identifier = string.Format(CultureInfo.InvariantCulture, "{0}/{1}/{2}", _vault, collection, _identifier);
        }
開發者ID:randorfer,項目名稱:azure-powershell,代碼行數:30,代碼來源:ObjectIdentifier.cs

示例3: SetChallengeForURL

        public void SetChallengeForURL(Uri url, HttpBearerChallenge value)
        {
            if (url == null)
                throw new ArgumentNullException("url");

            if (value == null)
                throw new ArgumentNullException("value");

            if (string.Compare(url.FullAuthority(), value.SourceAuthority, StringComparison.OrdinalIgnoreCase) != 0)
                throw new ArgumentException("Source URL and Challenge URL do not match");

            lock (_cacheLock)
            {
                _cache[url.FullAuthority()] = value;
            }
        }
開發者ID:Indhukrishna,項目名稱:azure-powershell,代碼行數:16,代碼來源:HttpBearerChallengeCache.cs

示例4: RemoveChallengeForURL

        public void RemoveChallengeForURL(Uri url)
        {
            if (url == null)
                throw new ArgumentNullException("url");

            lock (_cacheLock)
            {
                _cache.Remove(url.FullAuthority());
            }
        }
開發者ID:Indhukrishna,項目名稱:azure-powershell,代碼行數:10,代碼來源:HttpBearerChallengeCache.cs

示例5: GetChallengeForURL

        public HttpBearerChallenge GetChallengeForURL(Uri url)
        {
            if (url == null)
                throw new ArgumentNullException("url");

            HttpBearerChallenge value = null;

            lock (_cacheLock)
            {
                _cache.TryGetValue(url.FullAuthority(), out value);
            }

            return value;
        }
開發者ID:Indhukrishna,項目名稱:azure-powershell,代碼行數:14,代碼來源:HttpBearerChallengeCache.cs

示例6: ObjectIdentifier

        protected ObjectIdentifier(string vault, string collection, string name, string version = null)
        {
            if (string.IsNullOrEmpty(vault))
                throw new ArgumentNullException("vault");

            if (string.IsNullOrEmpty(collection))
                throw new ArgumentNullException("collection");

            if (string.IsNullOrEmpty(name))
                throw new ArgumentNullException("keyName");

            var baseUri = new Uri(vault, UriKind.Absolute);

            _name = name;
            _version = version;
            _vault = string.Format(CultureInfo.InvariantCulture, "{0}://{1}", baseUri.Scheme, baseUri.FullAuthority());
            _vaultWithoutScheme = baseUri.Authority;
            _baseIdentifier = string.Format(CultureInfo.InvariantCulture, "{0}/{1}/{2}", _vault, collection, _name);
            _identifier = string.IsNullOrEmpty(_version) ? _name : string.Format(CultureInfo.InvariantCulture, "{0}/{1}", _name, _version);
            _identifier = string.Format(CultureInfo.InvariantCulture, "{0}/{1}/{2}", _vault, collection, _identifier);
        }
開發者ID:theadriangreen,項目名稱:azure-sdk-for-net,代碼行數:21,代碼來源:ObjectIdentifier.cs

示例7: ValidateRequestURI

        private static string ValidateRequestURI(Uri requestUri)
        {
            if (null == requestUri)
                throw new ArgumentNullException("requestUri");

            if (!requestUri.IsAbsoluteUri)
                throw new ArgumentException("The requestUri must be an absolute URI", "requestUri");

            if (!requestUri.Scheme.Equals("http", StringComparison.CurrentCultureIgnoreCase) 
                && !requestUri.Scheme.Equals("https", StringComparison.CurrentCultureIgnoreCase))
                throw new ArgumentException("The requestUri must be HTTP or HTTPS", "requestUri");

            return requestUri.FullAuthority();
        }
開發者ID:Indhukrishna,項目名稱:azure-powershell,代碼行數:14,代碼來源:HttpBearerChallenge.cs


注:本文中的System.Uri.FullAuthority方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。