<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:snippet="http://codexchange.org/schemas/snippet/1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
  <channel>
    <title>CodeXchange: User Contributed Snippets</title>
    <link>http://www.codexchange.org</link>
    <description>Summary of the snippets published by a codexchange user</description>
    <language>en-us</language>
    <copyright>Copyright © CodeXchange, 2004-2006</copyright>
    <generator>CodeXchange RSS Feed Generator v1.0</generator>
    <webMaster>webmaster@codexchange.org</webMaster>
    <lastBuildDate>Thu, 15 Oct 2026 10:46:38 GMT</lastBuildDate>
    <ttl>20</ttl>
    <dc:language>en-us</dc:language>
    <dc:rights>Copyright © CodeXchange, 2004-2006</dc:rights>
    <dc:date>10/15/2026 10:46:38 AM</dc:date>
    <dc:publisher />
    <dc:creator>CodeXchange RSS Feed Generator v1.0</dc:creator>
    <item>
      <guid>/PreviewSnippet.aspx?SnippetID=d40708fc-4041-42b8-9016-f0ac96d14fce</guid>
      <title>Make your client overlook the certificate name mismatch programmatically. Little variation on code by Ted Graham and msdn.  The class must be assigned to System.Net.ServicePointManager.CertificatePolicy in the beginning of client code. </title>
      <link>/PreviewSnippet.aspx?SnippetID=d40708fc-4041-42b8-9016-f0ac96d14fce</link>
      <description>Make your client overlook the certificate name mismatch programmatically. Little variation on code by Ted Graham and msdn.  The class must be assigned to System.Net.ServicePointManager.CertificatePolicy in the beginning of client code.  [C#]</description>
      <author>Isabelle Therrien</author>
      <pubDate>Wed, 27 Apr 2005 12:22:21 GMT</pubDate>
      <comments>/PreviewSnippet.aspx?SnippetID=d40708fc-4041-42b8-9016-f0ac96d14fce#comments</comments>
      <category>e62f85c6-4f8b-4c92-843b-3bce972f5504</category>
      <dc:title>Make your client overlook the certificate name mismatch programmatically. Little variation on code by Ted Graham and msdn.  The class must be assigned to System.Net.ServicePointManager.CertificatePolicy in the beginning of client code. </dc:title>
      <dc:date>4/27/2005 12:22:21 PM</dc:date>
      <dc:creator>Isabelle Therrien</dc:creator>
      <content:encoded><![CDATA[<pre>	public class MyPolicy: ICertificatePolicy
	{
		enum CertificateProblem : long
		{
			CertEXPIRED                   = 2148204801,
			CertVALIDITYPERIODNESTING     = 2148204802,
			CertROLE                      = 2148204803,
			CertPATHLENCONST              = 2148204804,
			CertCRITICAL                  = 2148204805,
			CertPURPOSE                   = 2148204806,
			CertISSUERCHAINING            = 2148204807,
			CertMALFORMED                 = 2148204808,
			CertUNTRUSTEDROOT             = 2148204809,
			CertCHAINING                  = 2148204810,
			CertREVOKED                   = 2148204812,
			CertUNTRUSTEDTESTROOT         = 2148204813,
			CertREVOCATION_FAILURE        = 2148204814,
			CertCN_NO_MATCH               = 2148204815,
			CertWRONG_USAGE               = 2148204816,
			CertUNTRUSTEDCA               = 2148204818
		}
		
		/// <summary>
		/// Implement CheckValidationResult to ignore problems that 
		/// we are willing to accept. In this case, all those concerning Certificates.
		/// </summary>
		public bool CheckValidationResult(ServicePoint sp, X509Certificate cert,
			WebRequest request, int problem)
		{       
			foreach (CertificateProblem problemCode in Enum.GetValues(typeof(CertificateProblem)))
			{
				int Certificate = unchecked( (int) problemCode);
				if ( problem == Certificate ) // only accept server name failed match
					return true;
			}
			// The 1.1 framework calls this method with a problem of 0, even if nothing is wrong
			return (problem == 0);         
		} 
	}
</pre>]]></content:encoded>
      <snippet:downloads>4</snippet:downloads>
      <snippet:rating>3</snippet:rating>
      <snippet:language>C#</snippet:language>
    </item>
  </channel>
</rss>