There is nothing wrong with this code. The issue is site security, Freshdesk uses TLS1.2
. I was using .NET Framework 4.5.2 and that defaults to TLS1.1
– therefore it doesn’t work. Two solutions:
- Use a later framework. 4.7 certainly works as does .NET Core
- Add this line before the request:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;