internal HttpFormResponse Post(HttpFormGetRequest postRequest, string rawData) { WebRequest request = CreateRequest(postRequest.Url, postRequest.UserName, postRequest.Password, postRequest.ContentType, postRequest.Headers, postRequest.Cookies, true); PreapreRequestToPost(request, rawData); return(ReadResponse(request)); }
public void GetAsync(HttpFormGetRequest getRequest, Action <HttpFormResponse> onComplete, Action <Exception> onError) { WebRequest request = CreateRequest(getRequest.Url, getRequest.UserName, getRequest.Password, getRequest.ContentType, getRequest.Headers, getRequest.Cookies, false); try { request.BeginGetResponse(ResponseCallback, new StateContainer { Request = request, OnComplete = onComplete, OnError = onError }); } catch (Exception e) { if (onError != null) { onError(e); } } }
internal void PostAsync(HttpFormGetRequest postRequest, string rawData, Action <HttpFormResponse> onComplete, Action <Exception> onError) { WebRequest request = CreateRequest(postRequest.Url, postRequest.UserName, postRequest.Password, postRequest.ContentType, postRequest.Headers, postRequest.Cookies, true); byte[] content = Encoding.ASCII.GetBytes(rawData); request.ContentLength = content.Length; try { request.BeginGetRequestStream(RequestCallback, new StateContainer { Request = request, RequestContent = content, OnComplete = onComplete, OnError = onError }); } catch (Exception e) { if (onError != null) { onError(e); } } }
public void GetAsync(HttpFormGetRequest getRequest) { GetAsync(getRequest, null, null); }
public HttpFormResponse Get(HttpFormGetRequest getRequest) { WebRequest request = CreateRequest(getRequest.Url, getRequest.UserName, getRequest.Password, getRequest.ContentType, getRequest.Headers, getRequest.Cookies, false); return(ReadResponse(request)); }