[Mono-dev] Getting Server Certificate with HttpWebRequest?
Michał Ziemski
rook at roo.k.pl
Tue Aug 28 04:34:44 EDT 2007
Hi!
Try setting
System.Net.ServicePointManager.CertificatePolicy
There you will have access to the server's cert.
Cheers,
Michał Ziemski
Valon Cross pisze:
>
> 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
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
More information about the Mono-devel-list
mailing list