次の方法で共有


Authorization.ConnectionGroupId プロパティ

ユーザー固有接続の一意の識別子を取得します。

Public ReadOnly Property ConnectionGroupId As String
[C#]
public string ConnectionGroupId {get;}
[C++]
public: __property String* get_ConnectionGroupId();
[JScript]
public function get ConnectionGroupId() : String;

プロパティ値

認証エンティティに接続を関連付ける一意の文字列。

解説

ConnectionGroupId プロパティは、固有な認証エンティティに接続を関連付ける一意の文字列です。たとえば、NTLM 認証モジュールは、認証資格情報を固有な接続に関連付けて、接続の無効な再使用を防ぎます。

使用例

[Visual Basic, C#, C++] ConnectionGroupId プロパティを使用して、サーバーから返されたグループ識別子を取得する例を次に示します。詳細については、 AuthenticationManager クラスのトピックを参照してください。

 

        ' Create the encrypted string according to the Basic authentication format as
        ' follows:
        ' a)Concatenate the username and password separated by colon;
        ' b)Apply ASCII encoding to obtain a stream of bytes;
        ' c)Apply Base64 encoding to this array of bytes to obtain the encoded 
        ' authorization.
        Dim BasicEncrypt As String = MyCreds.UserName + ":" + MyCreds.Password

        Dim BasicToken As String = "Basic " + Convert.ToBase64String(ASCII.GetBytes(BasicEncrypt))

        ' Create an Authorization object using the encoded authorization above.
        Dim resourceAuthorization As New Authorization(BasicToken)

        ' Get the Message property, which contains the authorization string that the 
        ' client returns to the server when accessing protected resources.
        Console.WriteLine(ControlChars.Lf + " Authorization Message:{0}", resourceAuthorization.Message)

        ' Get the Complete property, which is set to true when the authentication process 
        ' between the client and the server is finished.
        Console.WriteLine(ControlChars.Lf + " Authorization Complete:{0}", resourceAuthorization.Complete)

        Console.WriteLine(ControlChars.Lf + " Authorization ConnectionGroupId:{0}", resourceAuthorization.ConnectionGroupId)


[C#] 
[C++] 
// Create the encrypted string according to the Basic authentication format as
// follows:
// a)Concatenate username and password separated by colon;
// b)Apply ASCII encoding to obtain a stream of bytes;
// c)Apply Base64 Encoding to this array of bytes to obtain the encoded
// authorization.
String* BasicEncrypt = String::Concat(MyCreds->UserName, S":", MyCreds->Password);

String* BasicToken = 
   String::Concat(S"Basic ", Convert::ToBase64String(ASCII->GetBytes(BasicEncrypt)));

// Create an Authorization object using the above encoded authorization.
Authorization* resourceAuthorization = new Authorization(BasicToken);

// Get the Message property which contains the authorization string that the
// client returns to the server when accessing protected resources
Console::WriteLine(S"\n Authorization Message: {0}", resourceAuthorization->Message);

// Get the Complete property which is set to true when the authentication process
// between the client and the server is finished.
Console::WriteLine(S"\n Authorization Complete: {0}", 
   __box(resourceAuthorization->Complete));

Console::WriteLine(S"\n Authorization ConnectionGroupId: {0}", 
   resourceAuthorization->ConnectionGroupId);
return resourceAuthorization;
   }
};

// This is the program entry point. It allows the user to enter
// her credentials and the Internet resource (Web page) to access.
// It also unregisters the standard and registers the customized basic
// authentication.
int main() {
   String* args[] = Environment::GetCommandLineArgs();

   if (args->Length < 4)
TestAuthentication::showusage();
   else {
// Read the user's credentials.
TestAuthentication::uri = args[1];
TestAuthentication::username = args[2];
TestAuthentication::password = args[3];

if (args->Length == 4)
   TestAuthentication::___domain = String::Empty;
else
   // If the ___domain exists, store it. Usually the ___domain name
   // is by default the name of the server hosting the Internet
   // resource.
   TestAuthentication::___domain = args[4];


// Instantiate the custom Basic authentication module.
CustomBasic* customBasicModule = new CustomBasic();

// Unregister the standard Basic authentication module.
AuthenticationManager::Unregister(S"Basic");

// Register the custom Basic authentication module.
AuthenticationManager::Register(customBasicModule);

// Display registered Authorization modules.
TestAuthentication::displayRegisteredModules();

// Read the specified page and display it on the console.
TestAuthentication::getPage(TestAuthentication::uri);
   }
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, Common Language Infrastructure (CLI) Standard

参照

Authorization クラス | Authorization メンバ | System.Net 名前空間