Beispiel #1
0
        /// <summary> 创建新的WebClient </summary>
        /// <returns></returns>
        public WebClient CreateWebClient()
        {
            var client = new WebClientWrapper();

            ResetWebClient(client);

            if (!string.IsNullOrEmpty(ProxyAddress))
            {
                client.Proxy = new WebProxy(ProxyAddress);
                if (NetworkCredential != null)
                {
                    client.Proxy.Credentials = NetworkCredential;
                }
            }
            else if (NetworkCredential != null)
            {
                client.UseDefaultCredentials = false;
                client.Credentials           = NetworkCredential;
            }

            return(client);
        }
		/// <summary> 创建新的WebClient </summary>
		/// <returns></returns>
		public WebClient CreateWebClient()
		{
			var client = new WebClientWrapper();
			ResetWebClient(client);

			if (!string.IsNullOrEmpty(ProxyAddress))
			{
				client.Proxy = new WebProxy(ProxyAddress);
				if (NetworkCredential != null)
				{
					client.Proxy.Credentials = NetworkCredential;
				}
			}
			else if (NetworkCredential != null)
			{
				client.UseDefaultCredentials = false;
				client.Credentials = NetworkCredential;
			}

			return client;
		}