Share via


NetworkCredential Oluşturucular

Tanım

NetworkCredential sınıfının yeni bir örneğini başlatır.

Aşırı Yüklemeler

NetworkCredential()

NetworkCredential sınıfının yeni bir örneğini başlatır.

NetworkCredential(String, SecureString)

Belirtilen kullanıcı adı ve parola ile sınıfının yeni bir örneğini NetworkCredential başlatır.

NetworkCredential(String, String)

Belirtilen kullanıcı adı ve parola ile sınıfının yeni bir örneğini NetworkCredential başlatır.

NetworkCredential(String, SecureString, String)

Belirtilen kullanıcı adı, parola ve etki alanı ile sınıfının yeni bir örneğini NetworkCredential başlatır.

NetworkCredential(String, String, String)

Belirtilen kullanıcı adı, parola ve etki alanı ile sınıfının yeni bir örneğini NetworkCredential başlatır.

NetworkCredential()

Kaynak:
NetworkCredential.cs
Kaynak:
NetworkCredential.cs
Kaynak:
NetworkCredential.cs

NetworkCredential sınıfının yeni bir örneğini başlatır.

public:
 NetworkCredential();
public NetworkCredential ();
Public Sub New ()

Açıklamalar

sınıfının parametresiz oluşturucu tüm NetworkCredential özelliklerini olarak nullbaşlatır.

Şunlara uygulanır

NetworkCredential(String, SecureString)

Kaynak:
NetworkCredential.cs
Kaynak:
NetworkCredential.cs
Kaynak:
NetworkCredential.cs

Önemli

Bu API, CLS uyumlu değildir.

Belirtilen kullanıcı adı ve parola ile sınıfının yeni bir örneğini NetworkCredential başlatır.

public:
 NetworkCredential(System::String ^ userName, System::Security::SecureString ^ password);
[System.CLSCompliant(false)]
public NetworkCredential (string? userName, System.Security.SecureString? password);
[System.CLSCompliant(false)]
public NetworkCredential (string userName, System.Security.SecureString password);
public NetworkCredential (string userName, System.Security.SecureString password);
[<System.CLSCompliant(false)>]
new System.Net.NetworkCredential : string * System.Security.SecureString -> System.Net.NetworkCredential
new System.Net.NetworkCredential : string * System.Security.SecureString -> System.Net.NetworkCredential
Public Sub New (userName As String, password As SecureString)

Parametreler

userName
String

Kimlik bilgileriyle ilişkili kullanıcı adı.

password
SecureString

Kimlik bilgileriyle ilişkili kullanıcı adının parolası.

Öznitelikler

Özel durumlar

sınıfı SecureString bu platformda desteklenmiyor.

Açıklamalar

Oluşturucu, özelliği olarak ve Password özelliği olarak ayarlanmış userNamepasswordbir NetworkCredential nesne UserName başlatır.

password parametresi bir SecureString örnektir.

Parametresi olarak ayarlanmış nullşekilde bu oluşturucu çağrılırsapassword, yeni bir örneği SecureString başlatılır, bu platformda güvenli dizeler desteklenmiyorsa,NotSupportedException

Şunlara uygulanır

NetworkCredential(String, String)

Kaynak:
NetworkCredential.cs
Kaynak:
NetworkCredential.cs
Kaynak:
NetworkCredential.cs

Belirtilen kullanıcı adı ve parola ile sınıfının yeni bir örneğini NetworkCredential başlatır.

public:
 NetworkCredential(System::String ^ userName, System::String ^ password);
public NetworkCredential (string userName, string password);
public NetworkCredential (string? userName, string? password);
new System.Net.NetworkCredential : string * string -> System.Net.NetworkCredential
Public Sub New (userName As String, password As String)

Parametreler

userName
String

Kimlik bilgileriyle ilişkili kullanıcı adı.

password
String

Kimlik bilgileriyle ilişkili kullanıcı adının parolası.

Örnekler

Aşağıdaki kod örneği, belirtilen kullanıcı adını ve parolayı kullanarak bir NetworkCredential nesne oluşturur.

// Call the onstructor  to create an instance of NetworkCredential with the
// specified user name and password.
NetworkCredential^ myCredentials = gcnew NetworkCredential( username,passwd );

// Create a WebRequest with the specified URL.
WebRequest^ myWebRequest = WebRequest::Create( url );
myCredentials->Domain = domain;
myWebRequest->Credentials = myCredentials;
Console::WriteLine( "\n\nCredentials Domain : {0} , UserName : {1} , Password : {2}",
   myCredentials->Domain, myCredentials->UserName, myCredentials->Password );
Console::WriteLine( "\n\nRequest to Url is sent.Waiting for response..." );

// Send the request and wait for a response.
WebResponse^ myWebResponse = myWebRequest->GetResponse();

// Process the response.
Console::WriteLine( "\nResponse received successfully." );

// Release the resources of the response object.
myWebResponse->Close();
 // Call the constructor to create an instance of NetworkCredential with the
 // specified user name and password.
 NetworkCredential myCredentials = new NetworkCredential(username,passwd);

// Create a WebRequest with the specified URL.
WebRequest myWebRequest = WebRequest.Create(url);
myCredentials.Domain = domain;
myWebRequest.Credentials = myCredentials;
Console.WriteLine("\n\nCredentials Domain : {0} , UserName : {1} , Password : {2}",
myCredentials.Domain, myCredentials.UserName, myCredentials.Password);
Console.WriteLine("\n\nRequest to Url is sent.Waiting for response...");

// Send the request and wait for a response.
WebResponse myWebResponse = myWebRequest.GetResponse();

// Process the response.
Console.WriteLine("\nResponse received successfully.");
// Release the resources of the response object.
myWebResponse.Close();
' Call the constructor  to create an instance of NetworkCredential with the
' specified user name and password.
Dim myCredentials As New NetworkCredential(username, passwd)
' Create a WebRequest with the specified URL. 
Dim myWebRequest As WebRequest = WebRequest.Create(url)
myCredentials.Domain = domain
myWebRequest.Credentials = myCredentials
Console.WriteLine(ControlChars.Cr + ControlChars.Cr + "Credentials Domain : {0} , UserName : {1} , Password : {2}", myCredentials.Domain, myCredentials.UserName, myCredentials.Password)
Console.WriteLine(ControlChars.Cr + ControlChars.Cr + "Request to Url is sent.Waiting for response...")
' Send the request and wait for a response.
Dim myWebResponse As WebResponse = myWebRequest.GetResponse()
' Process the response.
Console.WriteLine(ControlChars.Cr + "Response received successfully.")
' Release the resources of the response object.
myWebResponse.Close()

Açıklamalar

Oluşturucu, özelliği olarak ve Password özelliği olarak ayarlanmış userNamepasswordbir NetworkCredential nesne UserName başlatır.

Şunlara uygulanır

NetworkCredential(String, SecureString, String)

Kaynak:
NetworkCredential.cs
Kaynak:
NetworkCredential.cs
Kaynak:
NetworkCredential.cs

Önemli

Bu API, CLS uyumlu değildir.

Belirtilen kullanıcı adı, parola ve etki alanı ile sınıfının yeni bir örneğini NetworkCredential başlatır.

public:
 NetworkCredential(System::String ^ userName, System::Security::SecureString ^ password, System::String ^ domain);
[System.CLSCompliant(false)]
public NetworkCredential (string? userName, System.Security.SecureString? password, string? domain);
[System.CLSCompliant(false)]
public NetworkCredential (string userName, System.Security.SecureString password, string domain);
public NetworkCredential (string userName, System.Security.SecureString password, string domain);
[<System.CLSCompliant(false)>]
new System.Net.NetworkCredential : string * System.Security.SecureString * string -> System.Net.NetworkCredential
new System.Net.NetworkCredential : string * System.Security.SecureString * string -> System.Net.NetworkCredential
Public Sub New (userName As String, password As SecureString, domain As String)

Parametreler

userName
String

Kimlik bilgileriyle ilişkili kullanıcı adı.

password
SecureString

Kimlik bilgileriyle ilişkili kullanıcı adının parolası.

domain
String

Bu kimlik bilgileriyle ilişkili etki alanı.

Öznitelikler

Özel durumlar

sınıfı SecureString bu platformda desteklenmiyor.

Açıklamalar

Oluşturucu özelliği olarak ayarlanmış bir nesne başlatır, Password özellik olarak ayarlanır passwordve Domain özellik olarak ayarlanırdomain.UserNameNetworkCredentialuserName

password parametresi bir SecureString örnektir.

Parametresi olarak ayarlanmış nullşekilde bu oluşturucu çağrılırsapassword, yeni bir örneği SecureString başlatılır, bu platformda güvenli dizeler desteklenmiyorsa,NotSupportedException

Şunlara uygulanır

NetworkCredential(String, String, String)

Kaynak:
NetworkCredential.cs
Kaynak:
NetworkCredential.cs
Kaynak:
NetworkCredential.cs

Belirtilen kullanıcı adı, parola ve etki alanı ile sınıfının yeni bir örneğini NetworkCredential başlatır.

public:
 NetworkCredential(System::String ^ userName, System::String ^ password, System::String ^ domain);
public NetworkCredential (string userName, string password, string domain);
public NetworkCredential (string? userName, string? password, string? domain);
new System.Net.NetworkCredential : string * string * string -> System.Net.NetworkCredential
Public Sub New (userName As String, password As String, domain As String)

Parametreler

userName
String

Kimlik bilgileriyle ilişkili kullanıcı adı.

password
String

Kimlik bilgileriyle ilişkili kullanıcı adının parolası.

domain
String

Bu kimlik bilgileriyle ilişkili etki alanı.

Açıklamalar

Oluşturucu özelliği olarak ayarlanmış bir nesne başlatır, Password özellik olarak ayarlanır passwordve Domain özellik olarak ayarlanırdomain.UserNameNetworkCredentialuserName

Şunlara uygulanır