認証の完了ステータスを取得します。
Public ReadOnly Property Complete As Boolean
[C#]
public bool Complete {get;}
[C++]
public: __property bool get_Complete();
[JScript]
public function get Complete() : Boolean;
プロパティ値
認証処理が完了した場合は true 。それ以外の場合は false 。
解説
クライアントとサーバー間の認証処理が終了した場合、 Complete プロパティは true に設定されます。Kerberos モジュールなどの一部の認証モジュールは、クライアントとサーバー間で複数のラウンドトリップを使用して認証処理を完了します。認証処理を開始した WebRequest または派生クラスが認証中に割り込まないようにするために、認証モジュールは Complete プロパティを false に設定します。
使用例
[Visual Basic, C#, C++] Complete プロパティを使用して、認証の完了ステータスを取得する例を次に示します。詳細については、 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 ファミリ, .NET Compact Framework - Windows CE .NET, Common Language Infrastructure (CLI) Standard
参照
Authorization クラス | Authorization メンバ | System.Net 名前空間 | IAuthenticationModule