title: Sending Client Certificate though HttpWebRequest, intermittenly working
body: <p>I have created a web application that calls a web service that requires a Client Certificate for authentication. Here is a snippet of how I am building the request:</p>
  
  <pre><code>            // Grab Certificate
              X509Certificate2 cert2 = new X509Certificate2(AppDomain.CurrentDomain.BaseDirectory + GiftCardConfig.A2A_CertificateLocation, GiftCardConfig.A2A_CertificatePassword, X509KeyStorageFlags.MachineKeySet);
  
              // First Call Status Account
              StringBuilder urlStatus = new StringBuilder(GiftCardConfig.A2A_URL + "webservice.asp?");
              urlStatus.Append("userid=" + GiftCardConfig.A2A_UserID);
              urlStatus.Append("&amp;pwd=" + GiftCardConfig.A2A_Password);
              urlStatus.Append("&amp;sourceid=" + GiftCardConfig.A2A_SourceID);
              urlStatus.Append("&amp;cardnum=" + cardNumber);
              urlStatus.Append("&amp;purseno=" + GiftCardConfig.A2A_PurseID);
  
              urlStatus.Append("&amp;status=ACTIVATE");
  
              // Build HTTP Request
              HttpWebRequest wrStatus = (HttpWebRequest)WebRequest.Create(urlStatus.ToString());
              wrStatus.KeepAlive = true;
              wrStatus.Method = "GET";
              wrStatus.Accept = "text/xml";
              wrStatus.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 1.0.3705; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)";
              wrStatus.ClientCertificates.Clear();
              wrStatus.ClientCertificates.Add(cert2);
  </code></pre>
  
  <p>This all works, but only intermittenly. About every 24 hours the Server hosting the web service returns a 403:Forbidden error.  The only way to fix it is to do a iisreset of the server running the web application.  We are completely stumped about this issue and would like to know if this issue has something to do with the web application or the configuration of the server it is being hosted on.</p>
  
  <p>Any possible solutions or comments are greatly appreciated!</p>