2

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:

 // 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("&pwd=" + GiftCardConfig.A2A_Password); urlStatus.Append("&sourceid=" + GiftCardConfig.A2A_SourceID); urlStatus.Append("&cardnum=" + cardNumber); urlStatus.Append("&purseno=" + GiftCardConfig.A2A_PurseID); urlStatus.Append("&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); 

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.

Any possible solutions or comments are greatly appreciated!

1
  • Hi Larry, just out of interest did you find a solution to this? Cheers Tigger Commented Oct 12, 2010 at 21:10

2 Answers 2

1

You could try setting keep alive to false, though there may be a performance hit with this.

Sign up to request clarification or add additional context in comments.

Comments

0

Just on the off chance anyone else comes across this. We never did identify the cause, however re-installing the .NET framework on the server seemed to 'resolve' the issue. Although not ideal, this is the first time it happened in 5 years, therefore happy enough with our resolution for now.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.