I'm trying to do an integration with the http://api.beanstalkapp.com/
service and I'm having trouble doing the request in C #, it always returns the error below:
An exception of type 'System.Net.WebException' occurred in System.dll but was not handled in user code
Additional information: The underlying connection was closed: An unexpected error occurred while sending.
Follow the code below:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlBeanstalk);
request.Method = "GET";
request.Accept = "application/json";
request.ContentType = "application/json; charset=utf-8";
request.Headers.Add(HttpRequestHeader.Authorization, "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(username + ":" + password)));
WebResponse response = (HttpWebResponse)request.GetResponse();