Skip to content

Commit c1de04d

Browse files
authored
Moved TLS 1.2 setting before HttpWebRequest
1 parent f275012 commit c1de04d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Authorize.NET/Utility/HttpXmlUtility.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ public ANetApiResponse Send(ANetApiRequest apiRequest) {
5454
//Authenticate it
5555
AuthenticateRequest(apiRequest);
5656

57+
// Set Tls to Tls1.2
58+
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
59+
5760
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(_serviceUrl);
5861
webRequest.Method = "POST";
5962
webRequest.ContentType = "text/xml";
@@ -74,9 +77,6 @@ public ANetApiResponse Send(ANetApiRequest apiRequest) {
7477
serializer.Serialize(writer, apiRequest);
7578
writer.Close();
7679

77-
// Set Tls to Tls1.2
78-
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
79-
8080
// Get the response
8181
WebResponse webResponse = webRequest.GetResponse();
8282

0 commit comments

Comments
 (0)