how to set ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12 code example

Example: servicepointmanager.securityprotocol = securityprotocoltype.tls12 vb.net sample code

Imports System.Net
Imports System.Web.Optimization

Public Class MvcApplication
    Inherits System.Web.HttpApplication

    Protected Sub Application_Start()
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
        AreaRegistration.RegisterAllAreas()
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters)
        RouteConfig.RegisterRoutes(RouteTable.Routes)
        BundleConfig.RegisterBundles(BundleTable.Bundles)
    End Sub
End Class