Indy9.0是一套基于delphi的Internet开发组件,功能非常丰富。大多数时候,我们都会用TIDHttp组件向server端来模拟发送post或get请求,有些网站从安全角度考虑,都会要求client验证通过后,才能访问。

   那么如何在TidHTTP中发送验证需要的用户名与密码呢?示例代码如下:

MyHttp := TIdHttp.Create(nil);
try
  MyHttp .Request.Clear;
  MyHttp .Request.BasicAuthentication := True;

  MyHttp .Request.Authentication.Username := admin;
  MyHttp .Request.Authentication.Password := admin;
end;
  MyHttp .Get('http://192.168.1.129');
finally
  MyHttp .Free;
end;

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案