zoukankan      html  css  js  c++  java
  • 判断远程文件是否存在

            private bool RemoteFileExists(string fileUrl)
            {
                
    try
                {
                    HttpWebRequest re 
    = (HttpWebRequest)WebRequest.Create(fileUrl);
                    HttpWebResponse res 
    = (HttpWebResponse)re.GetResponse();
                    
    if (res.ContentLength != 0)
                    {
                        
    //MessageBox.Show("文件存在");
                        return true;
                    }
                }
                
    catch (Exception)
                {
                    
    //MessageBox.Show("无此文件");
                    return false;
                }
                
    return false;
            }
  • 相关阅读:
    谈谈Nullable<T>的类型转换问题
    MiniProfiler使用方法
    捕获变量
    web服务相关的问题或技巧
    对接mysql数据库遇见的一些问题
    委托
    导出到Excel
    斐波那契数列的运算时间
    .net framework摘抄与理解
    sql 语句
  • 原文地址:https://www.cnblogs.com/hantianwei/p/1596483.html
Copyright © 2011-2022 走看看