This documentation is archived and is not being maintained.

Authorization.Complete Property

Gets the completion status of the authorization.

[Visual Basic]
Public ReadOnly Property Complete As Boolean
[C#]
public bool Complete {get;}
[C++]
public: __property bool get_Complete();
[JScript]
public function get Complete() : Boolean;

Property Value

true if the authentication process is complete; otherwise, false.

Remarks

The Complete property is set to true when the authentication process between the client and the server is finished. Some authentication modules, such as the Kerberos module, use multiple round trips between the client and server to complete the authentication process. To keep the WebRequest or descendant that initiated the authentication process from interrupting while authorization is taking place, the authentication module sets the Complete property to false.

Example

[Visual Basic, C#, C++] The following example uses the Complete property to get the completion status of the authorization. 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, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

Authorization Class | Authorization Members | System.Net Namespace | IAuthenticationModule

Show: