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();
}
โ04-16-2019 01:03 AM
Anyone know the problem?
โ04-19-2019 05:16 AM
Windows Server 2008 doesn't have TLS 1.1 and TLS 1.2 by default. There is an optional KB update from Microsoft that adds it. I don't know if 32bit is supported.
โ04-19-2019 11:03 AM
โ04-19-2019 11:05 AM
I have tried to download each file and installed but I got error that Update doesn not apply to you system. I dont know how to fix this.
โ04-20-2019 11:43 PM
Make sure you are downloading the x86 version. You can also check the Optional updates on the server in control panel/Windows Update. That was where mine was waiting.
There is also a SHA2 update. (KB4039648) Make sure you have that installed also.
โ04-21-2019 12:25 PM
YES I tried to download all version and when I tried to install that i got message that This UPDATE doesn not apply to you system, I already updated Windows latest update, I searched for KB4039648 and tried install those updates but got same error, I am very frustated as problem is not going, It was working fine before and now its not working, Please let me know if you can help me for that.
โ04-22-2019 05:17 AM
I checked registry, TLS 1.2 is added on HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlset\SecurityProviders\SChannel\Protocol\
There I added TLS 1.2, There are other Items added there Multi Protocol Unified Hello,
PCT 1.0, SSL 2.0, SSL 3.0, TLS 1.0, TLS 1.1, Please let me know if anything wrong you see here.
โ04-22-2019 05:23 AM
I am thinking the update was superseeded. Look at installed updates. Was something installed about the time it stopped working?
I thought I had TLS 1.2 working on my Windows Server 2008 but it isn't showing up anymore. I don't really need it for anything and I plan to update to Server 2019 in a few months. My Authorize.net site runs under Ubuntu.
โ04-22-2019 10:11 AM
Cant say if update caused issue, Should I remove those updates? What approach may be used to fix that without updating to higher version, Please guide me where I can get more help to fix this?
โ04-22-2019 06:54 PM