Closing update As I've announced in a comment below, I've decided to stop fighting this issue since I'm pretty sure I can't fix it because of the imposibility to access the source code for the website. I've assumed most of the problems I'm facing are caused by a not-working-well decompiling process, so I don't find any reason to continue dealing with it at least for now. Thanks a lot to everybody that has read, thought in or tried to help me with this. I don't find a way of closing this question, probably due to my lack of privileges as a "new" user, so if someone with privileges read this and can help to close it, it will be appreciated :-)
Good morning. As this is my first post here I'd like to start thanking all of you for all your patient, empathic and priceless help. Now let's try to explain my situation as clear as possible: as many other people, I'm suffering the problem caused by TLS 1.2 standard: now I can't connect to our payment gateway (Realex Payments, in case it makes any difference) as they are rejecting all non-TLS 1.2 connections. I've "inherited" a complete website with tons of C# .NET deployed code (which, to be honest, I definetely don't master), so my first movements where to download all this code from the server and decompiled the dll files using .NET Reflector 9.0. The system is developed under .NET 3.5 framework, and I promise I read a lot about it here, in Microsoft support sites and throughout the web. The best solutions I could find came from this 2 posts here:
.NET Framework 3.5 and TLS 1.2
How to implement Security Protocols TLS 1.2 in .Net 3.5 framework
which basically have the same answer from D_Bester.
The problem I'm finding is that, when I try to paste this C# code:
public const SslProtocols _Tls12 = (SslProtocols)0x00000C00;
public const SecurityProtocolType Tls12 = (SecurityProtocolType)_Tls12;
ServicePointManager.SecurityProtocol = Tls12
before my httpwebrequest as the author pointed at, VS 2015 shows an error in the third sentence saying that
"The name 'ServicePointManager.SecurityProtocol' does not exist in the current context.
The name 'SecurityProtocol' does not exist in the current context."
More info in case it helps: I can't apply patches or edit registry as this whole site is hosted in an online hosting, but when we first faced this issue we asked them to migrate our contents to a new server supporting .Net framework 4.5.
Trying to follow the code and other solutions found, I've edited my SslProtocols.cs file manually adding the newer protocols to the enumeration like this:
namespace System.Security.Authentication
{
using System;
[Flags]
public enum SslProtocols
{
Default = 240,
None = 0,
Ssl2 = 12,
Ssl3 = 48,
Tls = 192,
Tls11 = 768,
Tls12 = 3072
}
}
but ServicePointManager.cs seems to not recognize my update since in one of the methods it uses as a parameter 'SslProtocols.Tls12' and it doesn't accept Tls12, just the original ones (Default, None, Ssl2, Ssl3 and Tls) so I might have to update that anywhere alse. I also tried adding Tls12 to SecurityProtocolType.cs enumeration and to SecurityProtocolTypeExtensions.cs, all this following indications from a source I'm not able to find now (I'd swear I had bookmarked but apparently I haven't).
I edit to add my list of imports in case it helps:
using System;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Net;
using System.Net.Cache;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Authentication;
using System.Security.Permissions;
using System.Text;
using System.Threading;
Any ideas? Or might I need to provide any additional info?