This documentation is archived and is not being maintained.

NetworkCredential.GetCredential Method (String, Int32, String)

Returns an instance of the NetworkCredential class for the specified host, port, and authentication type.

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

public NetworkCredential GetCredential (
	string host,
	int port,
	string authenticationType
public final NetworkCredential GetCredential (
	String host, 
	int port, 
	String authenticationType
public final function GetCredential (
	host : String, 
	port : int, 
	authenticationType : String
) : NetworkCredential
Not applicable.



The host computer that authenticates the client.


The port on the host that the client communicates with.


The type of authentication requested, as defined in the IAuthenticationModule.AuthenticationType property.

Return Value

A NetworkCredential for the specified host, port, and authentication protocol, or a null reference (Nothing in Visual Basic) if there are no credentials available for the specified host, port, and authentication protocol.

The value of authType corresponds to the IAuthenticationModule.AuthenticationType property.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0