Error: 'System.NotSupportedException' for SecurityProtocol on IIS

on Oct 06, 2016 07:17 AM



i have configured paypal on my server and added these lines to enabl tls requested by paypal in my application


but when i open the page it gives me following error

what should i do  Please advice
  ServicePointManager.Expect100Continue = true;
        ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
        ServicePointManager.DefaultConnectionLimit = 9999;

        //end of server protocal

        //Post back to either sandbox or live
        string strSandbox = "";

        //post of live
        string strLive = "";

        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(strSandbox);
        //Set values for the request back
        req.Method = "POST";
        req.ContentType = "application/x-www-form-urlencoded";
        byte[] param = Request.BinaryRead(HttpContext.Current.Request.ContentLength);
        string strRequest = Encoding.ASCII.GetString(param);
        string strResponse_copy = strRequest;  //Save a copy of the initial info sent by PayPal
        strRequest += "&cmd=_notify-validate";
        req.ContentLength = strRequest.Length;

        //for proxy
        //WebProxy proxy = new WebProxy(new Uri("http://url:port#"));
        //req.Proxy = proxy;
        //Send the request to PayPal and get the response
        StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
        StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream());
        string strResponse = streamIn.ReadToEnd();

        if (strResponse == "VERIFIED")


Download FREE API for Word, Excel and PDF in ASP.Net: Download
on Oct 06, 2016 07:20 AM

Hi nauna,

namespace System.Net
    public enum SecurityProtocolType
       Ssl3 = 48,
       Tls = 192,
       Tls11 = 768,
       Tls12 = 3072,
ServicePointManager.SecurityProtocol = (SecurityProtocolType)192 ||(SecurityProtocolType)768 || (SecurityProtocolType)3072;

Refer the below link.


on Oct 06, 2016 07:56 AM

where should i add this namespace in project? Please guide.



should i add this on my page or some where else?


on Oct 06, 2016 08:05 AM

This namespace already present. You need to select SecurityProtocolType and press F12 you will able to see the enum. Check the availe protocoltype in the system dll and you can use those only in your code.