407需要验证 - 不发送挑战 [英] 407 Authentication required - no challenge sent

查看:226
本文介绍了407需要验证 - 不发送挑战的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:

。如果你刚刚来到这个问题,一般的要点是,我试图通过代理做一个HttpWebRequest的,而且我米我们奇怪的代理服务器得到一个407。 IE,火狐,Chrome都设法成功地洽谈代理,因为这样做的Adobe AIR应用程序。这可能是重要的是,谷歌Chrome网络安装实际上失败,我们必须使用离线安装。

Update:
If you've just arrived at this question, the general gist is that I'm trying to make a HttpWebRequest via a proxy, and I'm getting a 407 from our strange proxy server. IE,Firefox,Chrome all manage to negotiate the proxy sucessfully, as do Adobe Air applications. It may be important that the Google Chrome web installer actually fails and we have to use an offline installer.

感谢Ian的链接我找到了让到下一个阶段。现在它发送一个令牌回代理服务器,然而第三阶段是没有得到通过,所以用的用户名/密码哈希请求不被.NET,因此没有返回HTML格式发送。

Thanks to Ian's link I've got it getting through to the next stage. It is now sending a token back to the proxy, however the 3rd stage isn't getting through, so the request with the username/password hash isn't being sent by .NET and consequently no HTML is returned.

我使用的:


  • IE6用户代理

  • Windows 7中

  • ScanSafe的代理

  • .NET 3.5

  • IE6 user-agent
  • Windows 7
  • Scansafe proxy
  • .NET 3.5

下面是等同于日志下面的最新代码:

Here's the latest code that equates to the logs below:

HttpWebRequest request = HttpWebRequest.Create("http://www.yahoo.com") as HttpWebRequest;
IWebProxy proxy = request.Proxy;
// Print the Proxy Url to the console.
if (proxy != null)
{
    // Use the default credentials of the logged on user.
    proxy.Credentials = CredentialCache.DefaultCredentials;
}
request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)";
request.Accept = "*/*";

HttpWebResponse response = request.GetResponse() as HttpWebResponse;
Stream stream = response.GetResponseStream();



例外

The exception

引发WebException(407)要求验证。

WebException (407) Authentication Required.

代理客户是我们的服务器机房,这(曾经与NTLM身份验证)一个<​​a href=\"http://www.scansafe.com/managed%5Fservices/web%5Ffiltering\"> ScanSafe的硬件设备然后指引你的HTTP流量,它的服务器来过滤流量。

The proxy being used

The proxy client is a Scansafe hardware device in our server room, which (once authenticated with NTLM) then directs your HTTP traffic to its servers to filter the traffic.

我还没有真正找到一个解决方案,但由于费罗兹和Eric我已经找到一个解决办法,发现实际的代理(而不是它的配置)是主要问题。这可能是3个变量一个不起眼的问题:.NET的HttpWebRequest的实现,Windows 7和当然,在我们的机架坐在ScanSafe的硬件客户端;但没有一个MSDN支持请求,我不会找到答案。

I haven't really found a solution but thanks to Feroze and Eric I have found a workaround and discovered that the actual proxy (and not its configuration) is the main issue. It may be an obscure issue with 3 variables: .NET HttpWebRequest's implementation, Windows 7 and of course the Scansafe hardware client that sits in our rack; but without an MSDN support request I won't find out.

推荐答案

如果您要设置凭据代理,不该 ŧ你request.Proxy对象上设置的凭据,而不是请求对象?

If you want to set credentials for the proxy, shouldn't you set credentials on the request.Proxy object rather than the request object?

http://msdn.microsoft.com/en-us/library/system.net.webproxy.credentials.aspx

此外,记住,你需要做一个HTTP / 1.1请求(或技术,以保持活动的任何请求)成功地使用NTLM /协商身份验证。

Also, keep in mind that you need to be making a HTTP/1.1 request (or technically, any request with Keep-Alive) to successfully use NTLM/Negotiate authentication.

(提琴手的验证督察会分解NTLM身份验证的斑点你,如果你还没有采取看看那个呢。)

(Fiddler's "Auth" inspector will decompose the NTLM authentication blobs for you, if you haven't taken a look at that yet.)

这篇关于407需要验证 - 不发送挑战的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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