我正在尝试使用 Indy HTTP 类进行 HTTP 身份验证。但是由于某些未知原因,我在这一行中遇到访问冲突错误: IdHTTP1.Request.Authentication.Username := Username;
代码延伸是:
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;
我正在使用 Delphi 2010,并且已经尝试过类似的操作: IdHTTP1.Request.Authentication.Username := 'admin'; 但没有解决问题...