Платеж Authorize.net перестал работать на 32-битной машине Windows Server 2008 - PullRequest
0 голосов
/ 21 апреля 2019

Authorize.net для платежного шлюза в моем коде Asp.net неожиданно перестал работать несколько дней назад. Я получаю сообщение об ошибке в строке ниже:

myWriter = new StreamWriter(objRequest.GetRequestStream()

Сообщение об ошибке исключения:

The request was aborted: Could not create SSL/TLS secure channel.'. See server logs for more details. 

Мой компьютер с Windows - Windows Server 2008, и я установил Framework 4.5.

Вот код,

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();
    }
...