URLRequestDefaults.setLoginCredentialsForHost不设置用户安培; PWD在授权头 [英] URLRequestDefaults.setLoginCredentialsForHost not setting the user & pwd in authorization header

查看:249
本文介绍了URLRequestDefaults.setLoginCredentialsForHost不设置用户安培; PWD在授权头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要访问的是由基本身份验证保护的HTML文件。 我试图加载这个HTML页中使用的HTMLLoader和发送方URLRequest请求。 我使用URLRequestDefaults类设置的凭据,但是当我看到被发送的小提琴手请求我没有看到任何授权头由这一套。 难道我在这里做得不对。我的code是如下。

  URLRequestDefaults.authenticate = FALSE;
URLRequestDefaults.setLoginCredentialsForHost(www.xyz.com,madhur,夏尔马);
VAR REQ:的URLRequest =新的URLRequest(http://bazinga.xyz.com/MyHtml/index.html);
htmlControl.htmlLoader.load(的URLRequest);
 

解决方案

您应该阅读<一个href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLRequestDefaults.html#setLoginCredentialsForHost%28%29"相对=nofollow> API 更仔细:

  

请注意是example.com,www.example.com和sales.example.com分别视为唯一的主机。

在这种情况下,结构域不匹配。

I want to access html files which are protected by basic authentication. I am trying to load this html page using htmlloader and sending the request by urlRequest. I am using URLRequestDefaults class to set the credentials but when I see the request being send in the fiddler I don't see any authorization header being set by this. Am I doing something wrong here. My code is below.

URLRequestDefaults.authenticate = false;
URLRequestDefaults.setLoginCredentialsForHost("www.xyz.com", "madhur", "sharma");
var req:URLRequest = new URLRequest("http://bazinga.xyz.com/MyHtml/index.html");
htmlControl.htmlLoader.load(urlRequest);

解决方案

You should read the API more carefully:

Note that "example.com", "www.example.com", and "sales.example.com" are each considered unique hosts.

In this case, the domains don't match.

这篇关于URLRequestDefaults.setLoginCredentialsForHost不设置用户安培; PWD在授权头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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