I'm trying to do a HTTP Authentication with Indy HTTP class. But for some unknown reason I'm getting an Access Violation error in this line: IdHTTP1.Request.Authentication.Username := Username;
The code stretch is:
IdHTTP1:= TIdHttp.Create(Application);
IdHTTP1.ConnectTimeout:= 10000;
IdHTTP1.Request.Clear;
IdHTTP1.Request.BasicAuthentication:= true;
IdHTTP1.Request.Authentication.Username := Username;
IdHTTP1.Request.Authentication.Password := Password;
try
IdHTTP1.Get(PbxURL);
HttpCode := IdHTTP1.ResponseCode;
except
on E: EIdHTTPProtocolException do
HttpCode := IdHTTP1.ResponseCode;
I'm using Delphi 2010, and already tried to do something like: IdHTTP1.Request.Authentication.Username := 'admin'; but didn't solved the problem...
00000000
, which means there's no object instance created forIdHTTP1.Request.Authentication
.) – HaswellRequest.Authentication
object instance created. See my answer. – Haswell