有没有办法用delphi的websense服务器进行身份验证?

时间:2009-08-04 14:33:49

标签: delphi authentication

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

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

错误消息是:

HTTP/1.0 302 Moved.

有没有人知道从代码中使用websense进行身份验证的方法?欢迎使用任何语言的示例 - 我使用的是Delphi和Indy的TIdHTTP组件。

2 个答案:

答案 0 :(得分:3)

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

仅当您希望身份验证允许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);
...

答案 1 :(得分:1)