From ed3bfb7462d44747230437717e8673a5192f833f Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期一, 30 十一月 2020 20:34:51 +0800 Subject: [PATCH] 2020-11-30-2 --- HDL_ON/DAL/Net/MyWebClient.cs | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-) diff --git a/HDL_ON/DAL/Net/MyWebClient.cs b/HDL_ON/DAL/Net/MyWebClient.cs new file mode 100644 index 0000000..37d4505 --- /dev/null +++ b/HDL_ON/DAL/Net/MyWebClient.cs @@ -0,0 +1,38 @@ +锘縰sing System; +using System.Net; + +namespace HDL_ON.DAL.Net +{ + public class MyWebClient : WebClient + { + int _timeout = 10000; + + /// <summary> + /// 瓒呮椂鏃堕棿(姣) + /// </summary> + public int Timeout { + get { + return _timeout; + } + set { + _timeout = value; + } + } + public MyWebClient () + { + + } + + public MyWebClient (int timeout) + { + this._timeout = timeout; + } + + protected override WebRequest GetWebRequest (Uri address) + { + var result = base.GetWebRequest (address); + result.Timeout = this._timeout; + return result; + } + } +} \ No newline at end of file -- Gitblit v1.8.0