Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Dec : IdHTTP Get() With Authorization?
| Subject: | IdHTTP Get() With Authorization? |
| Posted by: | "Slagert" (slage..@slagert.com) |
| Date: | Fri, 29 Dec 2006 22:51:26 |
I'm using the following code snippet in a procedure with Indy 10 & D7
var
InStream : TMemoryStream;
BaseURL := Edit1.Text;
IdHTTP1.Request.Username := Edit2.Text;
IdHTTP1.Request.Password := Edit3.Text;
try
InStream := TMemoryStream.Create;
try
IdHTTP1.Get(BaseURL, InStream);
except
on E: EIdException do begin
//Handle Indy exceptions here
end;
end;
finally
InStream.Free;
end;
This works OK with authorization but if I change the URL and User/password
and call the above code again I'm getting a 401 exception. Is there
something I need to do to reset the IdHTTP before fetching another URL with
authoration?
-Andy