Looking for old forum posts and information? View the old forum archive here ยป
Welcome to Vortx Community Forum, where you can ask questions and receive answers from the staff at Vortx and other members of the community.

If you had a user account on our previous forums website, you will need to register a new account here.

A static copy of our previous forums website is available online for reference. Click here to access the forum archive.

Learn more about...

AspDotNetStorefront
DotFeed

TLS 1.2 Patch provided in C# but need VB

I downloaded the TLS 1.2 patch in C# provided as part of the gold benefits, but need it in VB. I ran it through a translator and compared it to my original VB file, I'd like help ensuring the new code is correct before attempting the update.

 

Here is the code I have:

Option Infer On

' --------------------------------------------------------------------------------
' Copyright AspDotNetStorefront.com. All Rights Reserved.
' http://www.aspdotnetstorefront.com
' For details on this license please visit the product homepage at the URL above.
' THE ABOVE NOTICE MUST REMAIN INTACT. 
' --------------------------------------------------------------------------------
Imports System
Imports System.Web.Http

Public Class _Global
	Inherits AspDotNetStorefront.Global
	Public Sub New()
		AddHandler InitializeApplicationCompleted, AddressOf InitializeApplication_Completed
	End Sub

	Private Sub InitializeApplication_Completed(sender As Object, e As EventArgs)
		System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3
			Or System.Net.SecurityProtocolType.Tls
			Or System.Net.SecurityProtocolType.Tls11
			Or System.Net.SecurityProtocolType.Tls12

		GlobalConfiguration.Configure(AspDotNetStorefrontAdminApi.WebApiConfig.Register)
		GlobalConfiguration.Configuration.EnsureInitialized()
	End Sub
End Class

 

asked Jun 28 in MultiStore by totalnoob (250 points)

2 Answers

0 votes
 
Best answer

It's late and I'm questioning if this is real life, but the problem seems to have been the formatting I added to the code. I removed the formatting and it worked. For those who look at the code and notice, I also removed the Ssl3 line because I disabled that on my server, definitely not the cause of the problem because I removed that long before I got it working.

This is the code that worked:


Option Infer On

' --------------------------------------------------------------------------------
' Copyright AspDotNetStorefront.com. All Rights Reserved.
' http://www.aspdotnetstorefront.com
' For details on this license please visit the product homepage at the URL above.
' THE ABOVE NOTICE MUST REMAIN INTACT. 
' --------------------------------------------------------------------------------
Imports System
Imports System.Web.Http

Public Class _Global
	Inherits AspDotNetStorefront.Global

	Public Sub New()
		AddHandler InitializeApplicationCompleted, AddressOf InitializeApplication_Completed
	End Sub

	Private Sub InitializeApplication_Completed(ByVal sender As Object, ByVal e As EventArgs)
		System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls Or System.Net.SecurityProtocolType.Tls11 Or System.Net.SecurityProtocolType.Tls12
	
		GlobalConfiguration.Configure(AddressOf AspDotNetStorefrontAdminApi.WebApiConfig.Register)
		GlobalConfiguration.Configuration.EnsureInitialized()
	End Sub
End Class
answered Jun 29 by totalnoob (250 points)
0 votes
It's tough to be certain just eyeballin' it, but that looks right.  You have a dev/staging site you can test this on first, right?  Drop it in there and see what happens.  :)  As long as the site loads without error and you can put through a test transaction with the gateway you're using, you can be pretty confident it'll be OK on the live site.
answered Jun 28 by Vortx ScottS (12,950 points)
Yes, I have a test environment, I'm just not good at VB and was hoping someone here was and could help.

I tested it and it broke the site, I got a runtime error. The error didn't save in my system log. I'll play around with it a little to see what could be the problem and comment again if I get it to work.

Thank you!
If there's something wrong with the translated code, it's possible .NET isn't even able to start the site up, so it wouldn't be running to add anything to the system log.  If you can't figure it out, you can always post the error here and we can take a look.
...