Export (0) Print
Expand All

Authorization.ConnectionGroupId Property

Gets a unique identifier for user-specific connections.

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

Property Value

A unique string associating a connection with an authenticating entity.

Remarks

The ConnectionGroupId property is a unique string that associates a connection with a specific authenticating entity. For example, the NTLM authorization module ties the authentication credential information to a specific connection to prevent invalid reuse of the connection.

Example

[Visual Basic, C#, C++] The following example uses the ConnectionGroupId property to get the group identifier returned by the server. For a complete example, refer to the AuthenticationManager class.

[Visual Basic] 

        ' 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] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Common Language Infrastructure (CLI) Standard

See Also

Authorization Class | Authorization Members | System.Net Namespace

Show:
© 2014 Microsoft