你如何使用SSL 2.0 System.Web.HttpWebRequest对象? [英] How do you get a System.Web.HttpWebRequest object to use SSL 2.0?

查看:164
本文介绍了你如何使用SSL 2.0 System.Web.HttpWebRequest对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道我是否有所需的所有短语这个问题很好的信息,所以多多包涵。

I don't know if I have all the information needed to phrase this question well, so bear with me.

我有一个本地的网页(本地意义192.168。*),它保护的自签名的SSL证书。我试图访问使用System.Net.HttpWebRequest对象这个页面,但我遇到了一个奇怪的问题。

I have a local web page (local meaning 192.168.*) that is protected with a self-signed SSL cert. I'm trying to access this page using a System.Net.HttpWebRequest object, but I'm running into a weird problem.

如果此页面被访问在Internet Explorer中的使用SSL 2.0选项关闭,浏览器就返回一个错误,如果它无法建立连接。 (换句话说,一个浏览器连接错误,而不是一个服务器发送的错误。)如果使用SSL 2.0选项打开,页面正常工作,你会得到标准的警告,这是自签名证书,你要继续等(奇怪的是,火狐,据称没有SSL 2.0开启,工作得很好。)

If this page is accessed in Internet Explorer with the "Use SSL 2.0" option turned off, the browser returns back an error as if it can't establish a connection. (In other words, a browser connection error, as opposed to a server-sent error.) If the "Use SSL 2.0" option is turned on, the page works fine and you get the standard warning that this is a self-signed cert, do you want to continue, etc. (Oddly enough, Firefox, which supposedly does not have SSL 2.0 turned on, works just fine.)

现在我的问题是,我试图用一个HttpWebRequest对象和它的返回回错误访问此页面的连接已经被意外关闭,就像在使用SSL 2.0被关闭IE浏览器引发错误。 (我已经有code到位,忽略了一个事实,这是一个自签名的证书,但它甚至没有得到那么远。)

Now my problem is that I'm trying to access this page with an HttpWebRequest object and the error it's returning back is that the connection has been unexpectedly closed, just like the error IE throws when "Use SSL 2.0" is turned off. (I already have code in place to ignore the fact that it's a self-signed cert, but it's not even getting that far.)

我如何获得System.Net.HttpWebRequest,好了,使用SSL 2.0时,它使得它的要求?

How do I get the System.Net.HttpWebRequest to, well, "Use SSL 2.0" when it's making its request?

推荐答案

我已经打时SSL3打交道,虽然我不知道,如果同样的建议将工作SSL2这个问题我自己?

I've hit this issue myself when dealing with Ssl3, though I'm not sure if the same advice would work for SSL2?

要解决我设置了SSL3国旗,像这样的安全协议问题:

To work around the issue I set the Ssl3 flag on the security protocol like so:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;

请查看以下链接了解详情:

Check out these links for more details:

<一个href="http://msdn.microsoft.com/en-us/library/system.net.servicepointmanager.securityprotocol.aspx">system.net.servicepointmanager.securityprotocol在MSDN

MSDN上安全协议枚举

如果他们也许你指出正确的方向你的幸运:)

They might point you in the right direction if your lucky :)

这篇关于你如何使用SSL 2.0 System.Web.HttpWebRequest对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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