I have a strange situation and I was wondering if anyone can help.
I have a .NET DLL that is called from a VB6 application. I have extended this DLL to interface with a 3rd party web site. The 3rd party have a SDK which I'm using within my DLL. The SDK has a call to connect to the website which then performs OAuth2 authentication in order to obtain an access token for further calls to the web site.
When the DLL 'authorise' function is called (which contains the SDK Connect function call) from my test harness (also a .NET application) then everything is fine and works exactly as expected.
However, when the same DLL 'authorise' function is called from the VB6 application, the SDK's Connect function fails. The only useful information is the error is a 501 error.
In order to clarify things for me, I changed my DLL to make do the authentication using REST calls. Again, calling this from the .NET test harness all was well but calling from the VB6 application resulted in an error. After investigation it seemed that the error was related to TLS. I forced the DLL 'authorise' function to use TLS1.2, using ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
and the REST calls then worked.
So, for some reason it appears that when making the calls to the DLL from VB6, web calls from the DLL are using a lower version of TLS. Has anyone else seen this before?
I've found some articles regarding disabling TLS1.0 and 1.1 but none of this seems to have worked. Does anyone have any ideas?
Thank you in advance
I've found what the solution once, so in case anyone else stumbles on this in the future.
When running a VB6 application that references a .NET DLL, it seems that you should still have a .config file for that VB6 application (so a appname.exe.config file). For me, I used my DLL's config file (dllname.dll.config), renamed it and added it to the folder the EXE was in and everything started working.
Also, if you are debugging from the VB6 IDE, then you should create a vb6.exe.config file alongside the main vb6.exe and it works from the debugger then as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With