cd5WHjDyFWcpnNHvtHIbDA==
来源:互联网 发布:w10无法连接到windows 编辑:程序博客网 时间:2024/06/03 13:41
cd5WHjDyFWcpnNHvtHIbDA==
/// <summary> /// 获取网络日期时间 /// </summary> /// <returns></returns> public static string GetNetDateTime() { WebRequest request = null; WebResponse response = null; WebHeaderCollection headerCollection = null; string datetime = string.Empty; try { request = WebRequest.Create("https://www.baidu.com"); request.Timeout = 3000; request.Credentials = CredentialCache.DefaultCredentials; response = (WebResponse)request.GetResponse(); headerCollection = response.Headers; foreach (var h in headerCollection.AllKeys) { if (h == "Date") { datetime = headerCollection[h]; } } return datetime; } catch (Exception) { return datetime; } finally { if (request != null) { request.Abort(); } if (response != null) { response.Close(); } if (headerCollection != null) { headerCollection.Clear(); } } }
0 0
- cd5WHjDyFWcpnNHvtHIbDA==
- =
- <%=%> <%#%>
- :=
- :=
- +=
- <%%><%=%>
- ^=
- +=
- =
- +=
- \(|\)|\+|\-|\*|/|%|<+|>+|(>=)|(<=)|=|!=|\:|\!\:|([^\(\)\+\-\*/%<>=\!\:])+
- ================各种文字==========
- ==========感受=========
- Oracle====================================
- =========重新开张=========
- ========================
- ============读取联系人============
- 用gulp压缩js和css
- Linux Kernel 学习笔记2:模块参数
- 【2017/4/13】linux关于如何增加swap大小
- iOS中block块的存储位置&内存管理
- Spark 任务调度之Executor执行task并返回结果
- cd5WHjDyFWcpnNHvtHIbDA==
- SQLite的sqlite_sequence表
- 一起做RGB-D SLAM (6)
- 安利以及orz
- 有关ssh连接linux服务器后在mysql查询后输出中文结果乱码的的问题
- BZOJ 4316 小C的独立集
- JavaScript学习笔记之函数
- Spring配置数据源的三种方式 (JNDI\C3PO)
- height:100%失效