Board index » delphi » IdHttp an Password Dialog

IdHttp an Password Dialog

Hi

At first: I can't speak englisch very well. I'll try to write it as good as
possible.

I'va a problem with the TIdHttp-Component. I would like to log in to an with
.htaccess protected site. How can i do that? There's always the message that
I've no access.

Bye

Onz

--

 

Re:IdHttp an Password Dialog


try this

    Request.BasicAuthentication = True
    Request.Host = 'your URL'
    Request.Password = password
    Request.Username = username

Quote
"Moritz Mahling" <M...@onz24.de> wrote in message

news:3eddad77@newsgroups.borland.com...
Hi

At first: I can't speak englisch very well. I'll try to write it as good as
possible.

I'va a problem with the TIdHttp-Component. I would like to log in to an with
.htaccess protected site. How can i do that? There's always the message that
I've no access.

Bye

Onz

--

Re:IdHttp an Password Dialog


Quote
"Moritz Mahling" <M...@onz24.de> wrote in message

news:3eddad77@newsgroups.borland.com...

Quote
> I'va a problem with the TIdHttp-Component. I would
> like to log in to an with .htaccess protected site. How
> can i do that? There's always the message that I've no
> access.

Sounds like you didn't provide any username or password for the page.
TIdHTTP has an OnAuthorization event for exactly that purpose.  Use that
event to display your own login dialog and then fill in the Authentication
parameter of the event accordingly.  For example:

    procedure TForm1.IdHTTP1Authorization(Sender: TObject; Authentication:
TIdAuthentication; var Handled: boolean);
    begin
        // display your dialog
        if( the user supplied a username and password ) then
        begin
            Authentication.Username := the inputed user name;
            Authentication.Password := the inputed password;
            Handled := True;
        end;
    end;

Gambit

Other Threads