System.Net.CredentialKey.Match C# (CSharp) Method

Match() private method

private Match ( Uri uri, string authenticationType ) : bool
uri Uri
authenticationType string
return bool
        internal bool Match(Uri uri, string authenticationType) {
            if (uri==null || authenticationType==null) {
                return false;
            }
            //
            // If the protocols dont match this credential
            // is not applicable for the given Uri
            //
            if (string.Compare(authenticationType, AuthenticationType, StringComparison.OrdinalIgnoreCase) != 0) {
                return false;
            }

            GlobalLog.Print("CredentialKey::Match(" + UriPrefix.ToString() + " & " + uri.ToString() + ")");

            return IsPrefix(uri, UriPrefix);
        }
        //

Usage Example

示例#1
0
        public NetworkCredential GetCredential(Uri uriPrefix, string authType)
        {
            if (uriPrefix == null)
            {
                throw new ArgumentNullException("uriPrefix");
            }
            if (authType == null)
            {
                throw new ArgumentNullException("authType");
            }
            int num = -1;
            NetworkCredential     credential = null;
            IDictionaryEnumerator enumerator = this.cache.GetEnumerator();

            while (enumerator.MoveNext())
            {
                CredentialKey key = (CredentialKey)enumerator.Key;
                if (key.Match(uriPrefix, authType))
                {
                    int uriPrefixLength = key.UriPrefixLength;
                    if (uriPrefixLength > num)
                    {
                        num        = uriPrefixLength;
                        credential = (NetworkCredential)enumerator.Value;
                    }
                }
            }
            return(credential);
        }
All Usage Examples Of System.Net.CredentialKey::Match