gpt4 book ai didi

delphi - 通过Delphi使用Websense服务器进行身份验证的任何方法?

转载 作者:行者123 更新时间:2023-12-03 18:29:45 25 4
gpt4 key购买 nike

我们在工作场所使用websense互联网过滤器。我有一个尝试从互联网检索信息的应用程序。

在我的客户端计算机上,我必须手动通过websense进行身份验证(即,打开firefox并提供我的用户名/密码),否则我的应用程序尝试进​​行下载时会出现错误。

错误消息是:

HTTP/1.0 302 Moved.


有谁知道从代码通过websense进行身份验证的方法吗?欢迎使用任何语言的示例-我正在使用Delphi和Indy的TIdHTTP组件。

最佳答案

回答我自己的问题;这就是对我有用的。

仅当您希望身份验证让MSN / Live Messenger通过as described under "notes" at the end of this article.时,才需要自定义用户代理字符串。

在命令行应用程序中:

uses
... IdHTTP ...;

...
var
httpGetter: TIdHTTP;
...
httpGetter.Request.Username := username;
httpGetter.Request.Password := password;
httpGetter.HandleRedirects := True;
httpGetter.Request.BasicAuthentication := True;

//custom useragent required to let live messenger work
httpGetter.Request.UserAgent := 'MSN Explorer/9.0 (MSN 8.0; TmstmpExt)';

httpGetter.Get(url,MS);
...

关于delphi - 通过Delphi使用Websense服务器进行身份验证的任何方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1227874/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com