private void DispatchAsync(HttpClientRequest request, Action <string> callbackAction) { var httpClient = new Crestron.SimplSharp.Net.Http.HttpClient() { UseConnectionPooling = true, KeepAlive = false }; var callbackObject = new AsyncCallbackObject { Url = request.Url.Url, Callback = callbackAction, HttpClient = httpClient, RequestType = request.RequestType, Request = request.ContentString }; try { var error = httpClient.DispatchStringAsyncEx(request, Encoding.ASCII, AsyncCallback, callbackObject); if (error != Crestron.SimplSharp.Net.Http.HttpClient.DISPATCHASYNC_ERROR.PENDING) { ErrorMessage.Error("Unity.HttpClient.DispatchAsync({0}) {2} Error: {1}\r\n", request.Url.Url, error.ToString(), request.RequestType.ToString()); } } catch (Exception ex) { ErrorMessage.Error("Unity.HttpClient API Error: {0}", ex.Message); } }