![]() |
![]() ![]() ![]() |
auAutoUpgrader and auHTTP components.
|
type
|
TauHTTPPasswordRequestEvent = procedure(Sender: TObject;
|
var TryAgain: Boolean) of object;
|
|
property OnPasswordRequest: TauHTTPPasswordRequestEvent;
|
The OnPasswordRequest event can be used to implement custom dialog box which asks user for his username and password to get access to the file which stored in the password protected Web area.
|
|
![]() |
|
However, if you still want to use your own password-request dialog, then set TryAgain parameter to True to retry the HTTP query (attempt to download the file), and specify correct login information to the HTTPUsername and HTTPassword properties.
|
|
procedure TauAutoUpgrader.AutoUpgrader1PasswordRequest(Sender: TObject; var TryAgain: Boolean);
|
begin
|
{ PassForm is any form with two edit boxes used for entering the login information (username and password) }
|
if PassForm.ShowModal = ID_OK then
|
begin
|
auAutoUpgrader1.HTTPUsername := PassForm.UsernameEdit.Text;
|
auAutoUpgrader1.HTTPPassword := PassForm.PasswordEdit.Text;
|
TryAgain := True; // Retry download attempt
|
end;
|
end;
|
void __fastcall TForm1::auAutoUpgrader1PasswordRequest(TObject *Sender, bool &TryAgain)
|
{
|
if (PassForm->ShowModal() == ID_OK)
|
{
|
auAutoUpgrader1->HTTPUsername = PassForm->UsernameEdit->Text;
|
auAutoUpgrader1->HTTPPassword = PassForm->PasswordEdit->Text;
|
TryAgain = True; // Retry HTTP query (download attempt)
|
};
|
}
|
HTTPUsername, HTTPPassword and ShowMessages properties;
|
Password request (screenshot).
|