Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Jan : Re: HTTP.Get() with Authorization Trouble (2nd Post)
| Subject: | Re: HTTP.Get() with Authorization Trouble (2nd Post) |
| Posted by: | "yufeiying1" (yufeiyi..@gmail.com) |
| Date: | Sun, 7 Jan 2007 09:31:00 |
Andy,
You can try one of the following codes to see whether it sovles your
problem.
procedure TFormMain.Button1Click(Sender: TObject);
begin
Screen.Cursor := crHourglass;
Memo1.Clear;
with HTTP1 do
begin
Request.Clear;
Request.ContentLength = -1;
Request.Accept = 'text/html, */*';
Request.UserAgent = 'Mozilla/3.0 (compatible; Indy Library)'
Request.BasicAuthentication := true;
Request.Username := Edit2.Text;
Request.Password := Edit3.Text;
end;
try
InStream := TMemoryStream.Create;
try
IdHTTP1.Get(Edit1.Text, InStream);
except
on E: EIdException do begin
//Handle Indy exceptions here
end;
end;
InStream.Position := 0;
Memo1.Lines.LoadFromStream(InStream);
InStream.Position := 0;
finally
InStream.Free;
end;
Screen.Cursor := crDefault;
end;
+++++++++++++++++++++++++++++++++++++++++++++++++++++
procedure TFormMain.Button1Click(Sender: TObject);
begin
Screen.Cursor := crHourglass;
Memo1.Clear;
with HTTP1 do
begin
//Request.Clear;
Request.ContentLength = -1;
Request.Accept = 'text/html, */*';
Request.UserAgent = 'Mozilla/3.0 (compatible; Indy Library)'
Request.BasicAuthentication := true;
Request.Username := Edit2.Text;
Request.Password := Edit3.Text;
end;
try
InStream := TMemoryStream.Create;
try
IdHTTP1.Get(Edit1.Text, InStream);
except
on E: EIdException do begin
//Handle Indy exceptions here
end;
end;
InStream.Position := 0;
Memo1.Lines.LoadFromStream(InStream);
InStream.Position := 0;
finally
InStream.Free;
end;
Screen.Cursor := crDefault;
end;
>Remy could you or someone else who is a member of TeamB look at this
for me.
>
>-Andy
--- posted by geoForum on http://delphi.newswhat.com
none