WebClientProtocol.Credentials プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > WebClientProtocol.Credentials プロパティの意味・解説 

WebClientProtocol.Credentials プロパティ

XML Web サービス クライアント認証セキュリティ資格情報取得または設定します

名前空間: System.Web.Services.Protocols
アセンブリ: System.Web.Services (system.web.services.dll 内)
構文構文

Dim instance As WebClientProtocol
Dim value As ICredentials

value = instance.Credentials

instance.Credentials = value
public ICredentials Credentials { get; set;
 }
public:
property ICredentials^ Credentials {
    ICredentials^ get ();
    void set (ICredentials^ value);
}
/** @property */
public ICredentials get_Credentials ()

/** @property */
public void set_Credentials (ICredentials value)

プロパティ
XML Web サービス クライアントの ICredentials。

解説解説
使用例使用例

XML Web サービス (Math) を呼び出す ASP.NET Web フォームの例を次に示します。この Web フォームでは、EnterBtn_Click 関数の中で、Credentials プロパティ使用して認証資格情報明示的に設定しますユーザー名パスワード、およびドメインNetworkCredential クラスコンストラクタ渡されます。

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Net"
 %>

<html>
    <script language="VB" runat="server">
        Sub EnterBtn_Click(src As Object,
 e As EventArgs)
            Dim math As New
 MyMath.Math()

            ' Obtain password from a secure store.
            Dim SecurelyStoredPassword As String
 = String.Empty
            
            ' Set the client-side credentials using the Credentials
 property.
            Dim credentials = New NetworkCredential("Joe",
 SecurelyStoredPassword, "mydomain")
            math.Credentials = credentials
            
            Dim iTotal As Integer
 = math.Add(Convert.ToInt32(Num1.Text), Convert.ToInt32(Num2.Text))
            Total.Text = "Total: " + iTotal.ToString()
        End Sub
 
    </script>
 
    <body>
       <form action="MathClient.aspx" runat=server>
           
          Enter the two numbers you want to add and
 then press the Total button.
          <p>
          Number 1: <asp:textbox id="Num1" runat=server/>
  +
          Number 2: <asp:textbox id="Num2" runat=server/>
 =
          <asp:button text="Total" Onclick="EnterBtn_Click"
 runat=server/>
          <p>
          <asp:label id="Total"  runat=server/>
          
       </form>
    </body>
 </html>

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Net" %>

<html>
    <script language="C#" runat="server">
       void EnterBtn_Click(Object Src, EventArgs E) 
          {
            MyMath.Math math = new MyMath.Math();
            
            // Obtain password from a secure store.
            String SecurelyStoredPassword = String.Empty; 
 
            // Set the client-side credentials using the Credentials
 property.
            ICredentials credentials = new NetworkCredential("Joe"
,SecurelyStoredPassword,"mydomain");
            math.Credentials = credentials;
       
            int total = math.Add(Convert.ToInt32(Num1.Text), Convert.ToInt32(Num2.Text));
            Total.Text = "Total: " + total.ToString();
         }
 
    </script>
 
    <body>
       <form action="MathClient.aspx" runat=server>
           
          Enter the two numbers you want to add and then press the Total button.
          <p>
          Number 1: <asp:textbox id="Num1" runat=server/>  +
          Number 2: <asp:textbox id="Num2" runat=server/> =
          <asp:button text="Total" Onclick="EnterBtn_Click"
 runat=server/>
          <p>
          <asp:label id="Total"  runat=server/>
          
       </form>
    </body>
 </html>

<%@ Page Language="JSCRIPT" src="source.js" %>
<%@ Import Namespace="System.Net" %>

<html>
    <script language="JSCRIPT" runat="server">
        function EnterBtn_Click(src : Object, e : EventArgs){
            var math : MyMath.Math = new MyMath.Math()

            // Obtain password from a secure store.
            var SecurelyStoredPassword 
            
            // Set the client-side credentials using the Credentials
 property.
            var credentials : NetworkCredential = new
 NetworkCredential("Joe", SecurelyStoredPassword, "mydomain")
            math.Credentials = credentials
            
            var iTotal : int = math.Add(Convert.ToInt32(Num1.Text),
 Convert.ToInt32(Num2.Text))
            Total.Text = "Total: " + iTotal.ToString()
        }
 
    </script>
 
    <body>
       <form action="MathClient.aspx" runat=server>
           
          Enter the two numbers you want to add and then press the Total button.
          <p>
          Number 1: <asp:textbox id="Num1" runat=server/>  +
          Number 2: <asp:textbox id="Num2" runat=server/> =
          <asp:button text="Total" Onclick="EnterBtn_Click"
 runat=server/>
          <p>
          <asp:label id="Total"  runat=server/>
          
       </form>
    </body>
 </html>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebClientProtocol クラス
WebClientProtocol メンバ
System.Web.Services.Protocols 名前空間
ICredentials
NetworkCredential



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

辞書ショートカット

すべての辞書の索引

WebClientProtocol.Credentials プロパティのお隣キーワード
検索ランキング

   

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



WebClientProtocol.Credentials プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS