ServicePointManager.SecurityProtocol = ServicePointManager.SecurityProtocol code example

Example 1: Net.ServicePointManager.SecurityProtocol .net framework 4

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

Example 2: 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