you can call the following function with any https url and it will return the html from the page. I have tried it on over 100 different urls and they all work except for "https://adwords.google.com", which throws a WebException saying "The underlying connection
was closed: Could not establish secure channel for SSL/TLS." People out their should try this themselves. They have a valid certificate. If any experts out there have any comments on why this might be the case i would love to know. (Even weirder, i can make
this request fine when i use msxml) private string RequestPage(string url) { HttpWebRequest request; HttpWebResponse response; string responseText; // Create request request = (HttpWebRequest) WebRequest.Create(url); // Get response response = (HttpWebResponse)
request.GetResponse(); // Read response stream responseText = new StreamReader( response.GetResponseStream(), Encoding.UTF8 ).ReadToEnd(); response.Close(); return responseText; }
This is very weird. The inner exception of the thrown WebException says "The message received was unexpected or badly formatted". I though Google was simply banning unknown user agents to this specific site but after feeding it Opera's and
IE's user agent strings it still didn't work. A packet sniffer shows that a handshake fails right off the bat when conencting to Google. I've seen some posts that suggest to disable TLS handshake, others suggest to make sure the ASPNET account has access to
certificate stores, etc. Gotta do some more research...
None
0 Points
15 Posts
Interesting problem with google
Mar 02, 2004 06:00 PM|Brendon.NET|LINK
Member
130 Points
293 Posts
Re: Interesting problem with google
Mar 02, 2004 11:10 PM|MilanNegovan|LINK
http://www.AspNetResources.com
ASP.NET With Emphasis On Web Standards
None
0 Points
15 Posts
Re: Interesting problem with google
Mar 02, 2004 11:51 PM|Brendon.NET|LINK