用c#的判断远程文件是否存在_C/C++语言_黑客防线网安服务器维护基地--Powered by WWW.RONGSEN.COM.CN

用c#的判断远程文件是否存在

作者:黑客防线网安C/C++教程基地 来源:黑客防线网安C/C++教程基地 浏览次数:0

本篇关键词:是否存在文件远程
黑客防线网安网讯:    //1:    public static bool IsExist(string uri)            {                HttpWebRequest req = null;                HttpWebResponse res = null;                try         ...
    //1:
    public static bool IsExist(string uri)
            {
                HttpWebRequest req = null;
                HttpWebResponse res = null;
                try
                {
                    req = (HttpWebRequest)WebRequest.Create(uri);
                    req.Method = "HEAD";
                    req.Timeout = 100;
                    res = (HttpWebResponse)req.GetResponse();
                    return (res.StatusCode == HttpStatusCode.OK);
                }
                catch
                {
                    return false;
                }
                finally
                {
                    if (res != null)
                    {
                        res.Close();
                        res = null;
                    }
                    if (req != null)
                    {
       
    黑客防线网安服务器维护方案本篇连接:http://www.rongsen.com.cn/show-15276-1.html
网站维护教程更新时间:2012-04-04 22:52:29  【打印此页】  【关闭
我要申请本站N点 | 黑客防线官网 |  
专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479

footer  footer  footer  footer