예제 #1
0
        protected virtual WebClient CreateWebClient()
        {
            var client = new InnerWebClient(Timeout, OnCreateWebRequestUri, OnGetWebRequest, OnGetWebResponse);

            if (Headers != null)
            {
                for (var i = 0; i < Headers.Count; i++)
                {
                    client.Headers.Add(Headers.GetKey(i), Headers.Get(i));
                }
            }
            if (Encoding != null)
            {
                client.Encoding = Encoding;
            }
            if (this.Async)
            {
                client.DownloadStringCompleted += DownloadStringCompleted;
                client.UploadValuesCompleted   += UploadValueCompleted;
                client.UploadStringCompleted   += UploadStringCompleted;
            }
            return(client);
        }
예제 #2
0
 protected virtual WebClient CreateWebClient()
 {
     var client = new InnerWebClient(Timeout, OnCreateWebRequestUri, OnGetWebRequest, OnGetWebResponse);
     if (Headers != null)
     {
         for (var i = 0; i < Headers.Count; i++)
         {
             client.Headers.Add(Headers.GetKey(i), Headers.Get(i));
         }
     }
     if (Encoding != null)
     {
         client.Encoding = Encoding;
     }
     if (this.Async)
     {
         client.DownloadStringCompleted += DownloadStringCompleted;
         client.UploadValuesCompleted += UploadValueCompleted;
         client.UploadStringCompleted += UploadStringCompleted;
     }
     return client;
 }