[Mono-dev] Getting Server Certificate with HttpWebRequest?

Valon Cross vcross at thornburgmortgage.com
Sun Aug 26 22:04:47 EDT 2007


Hi, if this question is better posted to a list, please let me know:  

 

I want to query a server's SSL Certificate so I can test the "Not After"
value and see when the cert is about to expire.  

 

I tried the following technique (with my employer's URL) and can get the
HTML  back.  But I need to trap the SSL handshake conversation before
the HTML is returned:  

 

sURL = "https://thornburgmortgage.loanadministration.com/";

                this.webRequest =
(HttpWebRequest)System.Net.WebRequest.Create(sURL);

 

                // BuildReqStream(ref webrequest);

                HttpWebResponse webresponse;

                webresponse =
(HttpWebResponse)this.webRequest.GetResponse();

 

                Encoding enc = System.Text.Encoding.GetEncoding(1252);

                StreamReader loResponseStream = new 

                StreamReader(webresponse.GetResponseStream(),enc);

 

                string Response = loResponseStream.ReadToEnd();

 

                loResponseStream.Close();

                webresponse.Close();

                System.Console.WriteLine("Response Stream: " +
Response);

 

Do you know how to get the SSL information?  Is there something like
java's httpCommons for .NET 2005?

 

Thanks,

 

Valon Cross

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070826/370369af/attachment.html 


More information about the Mono-devel-list mailing list