2009-08-04 20 views
2

我在我的工作场所使用websense网络过滤器。我有一个应用程序试图从互联网上检索信息。任何方式来从德尔福的websense服务器进行身份验证?

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

的错误信息是:

HTTP/1.0 302 Moved. 

有谁知道的方式与Websense的代码进行验证?欢迎使用任何语言的示例 - 我正在使用Delphi和Indy的TIdHTTP组件。

回答

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); 
...