How to change security protocol to tls1.2 in IIS/ASP.NET?

Edit Global.asax file. Import the System.Net class and then change the security protocol to tls1.2 in the Applicatin_Start method.

<%@ application="" language="C#" %="">

<%@ import="" namespace="System.Net" %="">

<script runat="server">
    void Application_Start(object sender, EventArgs e)
        // Enforce the security protocol to TLS 1.2
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

Mike Mai
Mike Mai   Brooklyn, New York
I am full-stack web developer, passionate about building world class web applications. Knowledge in designing, coding, testing, and debugging. I love to solve problems.