开发者

SSL/TLS/HTTPS sites are very slow in a C#/.NET WebBrowser control, but fine in Internet Explorer

开发者 https://www.devze.com 2023-01-08 21:09 出处:网络
Background I\'m modifying AutoWikiBrowser to work with a MediaWiki site hosted on a secure server. I allow the user to login manually via a WebBrowser control in a C# application, and then save the s

Background

I'm modifying AutoWikiBrowser to work with a MediaWiki site hosted on a secure server. I allow the user to login manually via a WebBrowser control in a C# application, and then save the stored cookies for use in HttpWebRequest's.

The Problem

The problem I'm having is that any site which uses SSL/TLS (https:// urls) takes an incredibly long time to load, often timing out. I've tried this not only with the MediaWiki site in question, but also other secure sites like PayPal and secure GMail.

Out of curiosity I tried the same https sites in the help browser of Visual Studio, the [VB WebBrowser开发者_JAVA百科 Sample][2], and the [WPF WebBrowser Control Sample][3] and they were all dead slow. These same sites perform just fine in Internet Explorer 7 (and of course Firefox).

The Question

What would cause SSL/TLS sites (https urls) to be very slow using the .NET WebBrowser control, but load fine in Internet Explorer?


One of the things we ran into as well, when coding our chat application, and web services, was that HTTP, SSL type request would take a huge amount of time to resolve. In fact, when we were writing our site checker (which ensures all of our sites/services are online), it would initially take 20 seconds to 45 seconds to just load up all the sites.......not very useful in a .NET application.

However, when I set the Proxy to NULL it loaded up almost instantly.

Sometimes you'll have an error doing that tho, so you can do this too:

_api.Proxy = WebRequest.DefaultWebProxy;

But, i still find that:

_api.Proxy = null;

Still works best for most web requests.

You could also force the proxy and timeouts to be much smaller than the default WinHTTP settings inside of your app.config, but specifying the above should do the trick for ya.

0

精彩评论

暂无评论...
验证码 换一张
取 消