共用方式為


NetworkCredential.GetCredential Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Returns an instance of the NetworkCredential class for the specified Uniform Resource Identifier (URI) and authentication type.

Namespace:  System.Net
Assembly:  System.Net (in System.Net.dll)

Syntax

'Declaration
Public Function GetCredential ( _
    uri As Uri, _
    authType As String _
) As NetworkCredential
public NetworkCredential GetCredential(
    Uri uri,
    string authType
)

Parameters

  • uri
    Type: System.Uri
    The Uri that the client provides authentication for.
  • authType
    Type: System.String
    A string that specifies the type of authentication requested.

Return Value

Type: System.Net.NetworkCredential
A NetworkCredential object.

Implements

ICredentials.GetCredential(Uri, String)

Remarks

The GetCredential method always returns a reference to itself, regardless of the input parameters passed to this method.

The authType parameter is not currently used.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.