NetworkCredential コンストラクタとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > NetworkCredential コンストラクタの意味・解説 

NetworkCredential コンストラクタ (String, String)

指定したユーザー名パスワード使用して、NetworkCredential クラス新しインスタンス初期化します。

名前空間: System.Net
アセンブリ: System (system.dll 内)
構文構文

解説解説
使用例使用例

指定したユーザー名パスワード使用してNetworkCredential オブジェクト作成するコード例次に示します

' 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()
 // Call the onstructor  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 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 onstructor  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.set_Domain(domain);
myWebRequest.set_Credentials(myCredentials);
Console.WriteLine("\n\nCredentials Domain : {0} , UserName : "
    + "{1} , Password : {2}", myCredentials.get_Domain(),
    myCredentials.get_UserName(), myCredentials.get_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();
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
NetworkCredential クラス
NetworkCredential メンバ
System.Net 名前空間

NetworkCredential コンストラクタ (String, String, String)

指定したユーザー名パスワード、およびドメイン使用して、NetworkCredential クラス新しインスタンス初期化します。

名前空間: System.Net
アセンブリ: System (system.dll 内)
構文構文

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
NetworkCredential クラス
NetworkCredential メンバ
System.Net 名前空間

NetworkCredential コンストラクタ


NetworkCredential コンストラクタ ()




英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「NetworkCredential コンストラクタ」の関連用語

NetworkCredential コンストラクタのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



NetworkCredential コンストラクタのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS