using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace ZJ_BYD.Common { public class MyWebClient : WebClient { private int _timeout; /// /// 超时时间(毫秒) /// public int Timeout { get { return _timeout; } set { _timeout = value; } } public MyWebClient() { this._timeout = 60000; } public MyWebClient(int timeout) { this._timeout = timeout; } protected override WebRequest GetWebRequest(Uri address) { var result = base.GetWebRequest(address); result.Timeout = this._timeout; return result; } } }