Call API from ASP.NET using VB - Authentication failed
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!
Dim Authorization As String = Convert.ToBase64String(System.Text.Encoding.Default.GetBytes("apikey:x"))
Dim wHeader As WebHeaderCollection = New WebHeaderCollection()
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)
1 person has this question
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11;