Skip to main content


I'm trying to connect to the Freshdesk API from asp.net but I'm getting the following error:






Authentication failed because the remote party has closed the transport stream.






The code I am using is as follows.  Any help is greatly appreciated!






Thanks.






Dim Authorization As String = Convert.ToBase64String(System.Text.Encoding.Default.GetBytes("apikey:x"))



Dim wHeader As WebHeaderCollection = New WebHeaderCollection()



wHeader.Clear()



wHeader.Add("Authorization","Basic " + Authorization)







Dim wRequest As HttpWebRequest = CType(System.Net.HttpWebRequest.Create("https://xxxxxx.freshdesk.com/api/v2/tickets"), HttpWebRequest)



wRequest.Headers = wHeader



wRequest.ContentType = "application/json; charset=utf-8"



wRequest.Method = "GET"







Dim wResponse As HttpWebResponse = CType(wRequest.GetResponse(), HttpWebResponse)



FYI, I fixed this by specifying the security protocol:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11;