cancel
Showing results for 
Search instead for 
Did you mean: 

Authorize.net payment not working on 32bit Windows server 2008 machine

Hi I am using Authorize.net for payment gateway in my Asp.net code, It suddenly stopped working few days back,Please help me, 
I am getting error on below line
myWriter = new StreamWriter(objRequest.GetRequestStream()
Error is The exception message is 'The request was aborted: Could not create SSL/TLS secure channel.'. See server logs for more details. 
Here is code, My windows machine is Windows server 2008 and I have installed Framework 4.5. 

    I tried to setup same code on Windows server 2012 R2 and it is working fine there, Problem is in current Production machine(Windows server 2008 32bit) which is 32bit machine, Is Authorized.net not compatible with 32 bit machine? Please let me know

 

    Below is my code

ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
String ApiLogin = System.Configuration.ConfigurationManager.AppSettings["ApiLoginL"];
String TransactionKey = System.Configuration.ConfigurationManager.AppSettings["TransactionKeyL"];


String post_url = "https://secure2.authorize.net/gateway/transact.dll";

Dictionary<string, string> post_values = new Dictionary<string, string>();

post_values.Add("x_login", ApiLogin);
post_values.Add("x_tran_key", TransactionKey);
post_values.Add("x_delim_data", "TRUE");
post_values.Add("x_delim_char", "|");
post_values.Add("x_relay_response", "FALSE");

post_values.Add("x_type", "AUTH_CAPTURE");
post_values.Add("x_method", "CC");
post_values.Add("x_card_num", OrderD.CARDNUMBER);

post_values.Add("x_card_code", OrderD.CVV);

post_values.Add("x_exp_date", OrderD.MONTH + "" + OrderD.YEAR);

post_values.Add("x_amount", "1");


post_values.Add("x_description", "");

StrSql = "SELECT USERID, FIRSTNAME,LASTNAME,COMPANYNAME,(STREETADDRESS1||' '||STREETADDRESS2)ADDRESS,STATE,ZIPCODE,CITY,COUNTRY FROM USERCONTACTS ";
StrSql = StrSql + "WHERE USERID= " + OrderD.USERID + " ";
dt = OdButil.FillDataTable(StrSql, MyConnectionString);


post_values.Add("x_first_name", dt.Rows[0]["FIRSTNAME"].ToString());
post_values.Add("x_last_name", dt.Rows[0]["LASTNAME"].ToString());
post_values.Add("x_company", dt.Rows[0]["COMPANYNAME"].ToString());

post_values.Add("x_address", dt.Rows[0]["ADDRESS"].ToString());
post_values.Add("x_state", dt.Rows[0]["STATE"].ToString());
post_values.Add("x_zip", dt.Rows[0]["ZIPCODE"].ToString());
post_values.Add("x_city", dt.Rows[0]["CITY"].ToString());
post_values.Add("x_country", dt.Rows[0]["COUNTRY"].ToString());

String post_string = "";/* TODO ERROR: Skipped SkippedTokensTrivia */

foreach (KeyValuePair<string, string> post_value in post_values)/* TODO ERROR: Skipped SkippedTokensTrivia */
post_string += post_value.Key + "=" + HttpUtility.UrlEncode(post_value.Value) + "&";/* TODO ERROR: Skipped SkippedTokensTrivia */
post_string = post_string.TrimEnd('&');/* TODO ERROR: Skipped SkippedTokensTrivia */

//Create an HttpWebRequest object to communicate with Authorize.net
HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(post_url);/* TODO ERROR: Skipped SkippedTokensTrivia */
objRequest.Method = "POST";
objRequest.ContentLength = post_string.Length;
objRequest.ContentType = post_url;

//post data is sent as a stream
StreamWriter myWriter = null;/* TODO ERROR: Skipped SkippedTokensTrivia */
myWriter = new StreamWriter(objRequest.GetRequestStream());/* TODO ERROR: Skipped SkippedTokensTrivia */
myWriter.Write(post_string);
myWriter.Close();

//returned values are returned as a stream, then read into a string
String post_response;
HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream()))
{
post_response = responseStream.ReadToEnd();
responseStream.Close();
}

smandola
Contributor
11 REPLIES 11

Played with my Windows Server 2008 x64 yesterday.  With the SCHANNEL registry settings I am getting TLS 1.2 with the latest updates.  The only way to test was Firefox to the servers IIS website.  Firefox confirmed TLS 1.2 connection.

 

There is supposed to be a way to get IE 9 to use TLS 1.2 with group policy but I couldn't get that to work.

 

Also found out there is a .net 4.0/4.5 registry setting you can use.

 

Maybe this link can help.

kabutotx
Regular Contributor

What best I can do and where I can take best help, Please advice.