且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

System.Net.WebClient与代理身份验证407错误

更新时间:2023-09-20 16:44:52

如果代理身份验证使用BASIC或DIGEST,则Internet Explorer不会持久缓存/重复使用代理身份验证凭据.对于协商/NTLM",将提供默认凭据.

Internet Explorer does not persistently cache/reuse proxy authentication credentials if the proxy auth uses BASIC or DIGEST. For Negotiate/NTLM, default credentials will be provided.

因此,即使.NET继承自IE设置,除非您恰好在IE中运行,否则您将无法获得对Basic/Digest代理身份验证的任何免费"支持.您需要提示用户或提供配置屏幕.

Hence, even though .NET inherits from IE settings, you won't get any "free" support for proxy authentication for Basic/Digest unless you happen to be running in IE; you'll need to prompt the user or provide a configuration screen.

Fiddler(www.fiddler2.com)在规则"菜单上具有请求代理身份验证"选项,可用于模拟此场景进行测试.

Fiddler (www.fiddler2.com) has the "Request Proxy Authentication" option on the Rules menu that you can use to simulate this scenario for testing.