public static DownloadStringAsync ( |
||
address | ||
clientCert | ||
millisecondsTimeout | int | |
downloadProgressCallback | DownloadProgressEventHandler | |
completedCallback | RequestCompletedEventHandler | |
Результат |
public void BeginGetResponse(byte[] postData, string contentType, int millisecondsTimeout) { _PostData = postData; _ContentType = contentType; if (_Request != null) { _Request.Abort(); _Request = null; } if (postData == null) { // GET //Logger.Log.Debug("[CapsClient] GET " + _Address); _Request = CapsBase.DownloadStringAsync(_Address, _ClientCert, millisecondsTimeout, DownloadProgressHandler, RequestCompletedHandler); } else { // POST //Logger.Log.Debug("[CapsClient] POST (" + postData.Length + " bytes) " + _Address); _Request = CapsBase.UploadDataAsync(_Address, _ClientCert, contentType, postData, millisecondsTimeout, null, DownloadProgressHandler, RequestCompletedHandler); } }
public void StartRequest(byte[] postData, string contentType) { _PostData = postData; _ContentType = contentType; if (_Client.IsBusy) { _Client.CancelAsync(); } _Client.Headers.Clear(); // Proxy if (Proxy != null) { _Client.Proxy = Proxy; } // Content-Type if (!String.IsNullOrEmpty(contentType)) { _Client.Headers.Add(HttpRequestHeader.ContentType, contentType); } else { _Client.Headers.Add(HttpRequestHeader.ContentType, "application/xml"); } if (postData == null) { _Client.DownloadStringAsync(_Client.Location); } else { _Client.UploadDataAsync(_Client.Location, postData); } }