代理授权的动作,以避免操作系统提示 [英] Proxy Authorization in actionscript to avoid OS prompt

查看:345
本文介绍了代理授权的动作,以避免操作系统提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个空气应用程序,我想补充Proxy-Authorization头每当我的客户端是使用代理。我加入'代理Authoriztion标头中的URLRequest头,但仍然我得到的操作系统提示用户名/密码。

I have an air app and I want to add proxy-authorization header whenever my client is behind a proxy. I am adding 'proxy-Authoriztion' header in urlRequest headers but still I am getting the OS prompt for username/password.

var loader:HTMLLoader = new HTMLLoader();
var be:Base64Encoder = new Base64Encoder();
be.insertNewLines = false;
be.encode("test" + ":" + "test");    
var urlRequest:URLRequest = new URLRequest("http://google.co.in");
urlRequest.authenticate = false;
urlRequest.requestHeaders.push(new URLRequestHeader("Proxy-Authorization","Basic "+ be.toString())); 
page.htmlLoader.load(urlRequest);

我检查小提琴手什么,我看到的是, 第一个响应是301和代理授权头被添加 第二个反应是407和Proxy-Authorization头不会被添加。

I checked fiddler and what I see is that 1st Response is 301 and proxy-authorization header is added 2nd Response is 407 and proxy-authorization header is not added.

在此我得到的操作系统提示。 任何人有任何想法对吗?

After this I get the OS prompt. Anybody has any ideas on this?

推荐答案

我有完全相同的问题,只是授权头。下面是我的解决方案:

I had that exact same problem, just for Authorization headers. Here is my solution:

var service:HTTPService = new HTTPService();
...
var encoder:Base64Encoder = new Base64Encoder();
encoder.encode(userName+':'+password);
service.headers["Authorization"] = "Basic " + encoder.toString();
...
service.send();

有关这个工程有的没有明显的原因。尝试(但记得要改变授权头在我的例子与代理授权)

For some none apparent reason this works. Try that ( but remember to change the "Authorization" header in my example with "Proxy-Authorization")

这篇关于代理授权的动作,以避免操作系统提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆