I have an ASP.NET C# web application which is hosted on GoDaddy (.NET 3.5, IIS 6) and have recently started getting the following error when attempting to connect via a WebRequest:
System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure
The code is as follows (pretty much straight from the samples):
HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create("https://test.authorize.net/gateway/transact.dll");
objRequest.Method = "POST";
objRequest.ContentLength = strPost.Length;
objRequest.ContentType = "application/x-www-form-urlencoded";
myWriter = new StreamWriter(objRequest.GetRequestStream());
At some point this was working. What can cause the application to start throwing this error?
10-24-2010 08:33 PM
Make sure that you are not expecting a specific IP address to open the connection. You should always use our domain name, authorize.net, instead of the IP address. Authorize.Net's IP addresses can change without notice or warning which can disrupt your integration if you are using the IP address to allow the connection to open. Recently our test environment IP addresses changed, so this could be the cause of the error that you are seeing. If your servers are not expecting a specific IP address try flushing your DNS cache to see if that resolves the error. If your servers are expecting a specific IP, please adjust this to the domain name.
Thank you,
Elaine
10-27-2010 03:55 PM
I'm getting the same error on the same section of code, and flushing the dns cache is not resolving the issue. I'm wondering if this is related to my other posted issue (
http://community.developer.authorize.net/t5/Integration-and-Testing/ARB-error-responses-not-working-... as this problem only occurs on my local development environment and not on our remote production servers.
10-29-2010 04:42 PM
No, I do not believe that this matter and the scenario you describe in your other post are related. If it were you would be seeing the same error in both situations, and you are not. This error specifically indicates that there is a problem with connection. Make sure that SSL 3.0 and/or TLS 1.0 are enabled on your server and that you do not have any firewall rules in place that would prevent the connection from taking place, which could include expecting a specific IP address to be used on our end that is not being used.
Thank you,
Elaine
11-01-2010 06:10 PM
I am having the exact same problem connecting from any servers to test.authorize.net. When I connect to secure.authorize.net the transaction goes through and i get a response from authorize.net? Any Ideas why this is happening on the test servers?????
11-24-2010 06:56 AM
The only reason that would make sense would be that you are expecting a connection to open from a specific URL in the Authorize.Net system, and your system is expecting the wrong URL. You should never code your server to expect a specific IP address, you should instead use the domain of authorize.net as IP addresses can change without notice at any time.
Thanks,
Elaine
12-06-2010 12:32 AM
I'm getting this error too. I'll have code that connects to download the settled transaction list, then the unsettled transaction list, then, if I haven't already downloaded the details, it connects to download the transaction details.
The code is all the same, yet between the time it downloads the transaction list and the transaction details, I get a security error. I cannot replicate this in my dev environment. Resetting IIS on the server where the website is will make the problem go away, but there's nothing in the code that expects a particular IP.
Here's the exact exception:
The remote certificate is invalid according to the validation procedure.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it
originated in the code.
Exception Details: System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
Here is the culprit in the stack trace:
AuthorizeNet.HttpXmlUtility.Send(ANetApiRequest apiRequest) +745
AuthorizeNet.ReportingGateway.GetTransactionDetails(String transactionID) +100
Any help is greatly appreciated.
03-29-2013 11:41 AM
There is a few solution if you google the error message. Did you open a new connection for each one?
03-29-2013 12:06 PM
No, I'm doing one
var gate = new ReportingGateway(apiLogin, transactionKey, ServiceMode.Live);
At the beginning of the routine and reusing the same gate throughout the transaction list import. I'll try recreating the gate at each step and see if it resolve the issue.
Thanks for the tip! I'll report back on success/failure.
03-29-2013 05:15 PM