using HttpWebRequest to access SSL-enabled site, get error: Could not establish secure channel for S

S

Steven Pu

Hi,

Specifically, the website I am trying to access is,

https://gmail.google.com/

I've read elsewhere that Google only uses SSL2, while .NET uses SSL3
and is not backward compatible. Is this true?

In any case, I want to know how this problem can be solved. The code
I'm using is dead simple,

HttpWebRequest req;
HttpWebResponse res;

req = (HttpWebRequest)HttpWebRequest.Create("https://gmail.google.com");
res = (HttpWebResponse)req.GetResponse();

Any help would be greatly appreciated. Thanks.

Cheers,
Steven
 
T

Trebek

Simply implement ICertificatePolicy in your class and return true from the
'CheckValidationResult' method

HTH,

Alex
 
J

Joerg Jooss

Trebek said:
Simply implement ICertificatePolicy in your class and return true
from the 'CheckValidationResult' method

I doubt that this will help in case the underlying protocol is not
supported. Does it?
 
S

Steven Pu

Hi Alex,

To tell you the truth, I really have no idea how this works - I'm
pretty new at this.

After looking up ICertifcatePolicy, I really don't see how it helps
me. My guess is that the reason HttpWebRequest fails is due to some
kind of error/incompatibilities of the request itself, so shouldn't I
be changing some properties of the request object? How does
ICertificatePolicy come in?

Thanks.

Cheers,
Steven
 
P

Peer Jakobsen

Hi Steven,

It wont help you if you create your own CertificatePolicy class that
accepts all certificates. The problem really is that Microsoft for
some strange reason only implemented SSL 3.0 support in
HttpWebRequest.

As you mentioned, Google runs SSL 2.0, hence the only solution is to
use another HTTP component.

I first tried PocketHTTP, which is free, and it worked really great
until i needed to do a HTTP Post with content type
"multipart/form-data". I then switched to the "IPWorks SSL V6 .Net
Edition" component (400$) and i haven't had any problems since.

Regards,

Peer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top