Mono Class Library: System.Net.CredentialCache Overview | Members

System.Net.CredentialCache.GetCredential Method

Returns the System.Net.NetworkCredential instance associated with a URI and authentication type. [Edit]

public NetworkCredential GetCredential (Uri uriPrefix, string authType)

Parameters

uriPrefix
A Uri that contains the URI prefix of resources for which the client will be authenticated. [Edit]
authType
A string containing the authentication type used by the resource named in uriPrefix . This string is required to be identical to the IAuthenticationModule.AuthenticationType of the authentication module that uses the credential. [Edit]

Returns

A System.Net.NetworkCredential, or null if there is no matching credential in the cache. [Edit]

Exceptions

TypeReason
ArgumentNullExceptionThe uriPrefix or authType parameter is null. [Edit]

Remarks

This method searches the System.Net.CredentialCache and returns the System.Net.NetworkCredential instance for the specified URI prefix and authentication type. This method uses the longest matching URI prefix in the cache to determine which credentials to return for an authentication type.

Note:

The following table shows the matches for a set of URI prefixes (assuming the URI prefixes are all cached for the specified authentication type).

URI PrefixMatches
http://www.contoso.com/portal/news.htmMatches only requests for http://www.contoso.com/portal/news.htm.
http://www.contoso.com/portal/Matches requests for all resources in the portal path, except for requests for the http://www.contoso.com/portal/news.htm page.
http://www.contoso.com/Matches requests for all resources at www.contoso.com, except those in the portal path.
[Edit]

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0