It was working well before a week but now it shows following error. I have tried the following things but of no use.
ServicePointManager.Expect100Continue =
Indeed changing SecurityProtocolType.Tls fixes the problem, if you´re working in VS with a framework lower than 4.5 you won´t be able to change it, you have to upgrade your VS to a highest version 2012/2013/2015 to change it.
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;