您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

C# 判断远程文件是否存在

2025/7/2 20:08:05发布22次查看
#region 判断远程文件是否存在 /// <summary> /// 判断远程文件是否存在 /// </summary> ///<param name="fileurl"> /// <returns></returns> public static bool remotefileexists(string fileurl) { httpwebrequest re = null; httpwebresponse res = null; try { re = (httpwebrequest)webrequest.create(fileurl); res = (httpwebresponse)re.getresponse(); if (res.contentlength != 0) { //messagebox.show("文件存在"); return true; } } catch (exception) { //messagebox.show("无此文件"); return false; } finally { if (re != null) { re.abort();//销毁关闭连接 } if (res != null) { res.close();//销毁关闭响应 } } return false; } #endregion
以上就是c# 判断远程文件是否存在的内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product