关于文件的删除问题? 看来人气不够啊,楼主!我帮你顶一下先! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 先关闭文件流在删 System.Text.Encoding resEncoding = System.Text.Encoding.GetEncoding("gb2312");//设置编码 System.IO.FileInfo f = new FileInfo(Server.MapPath(RootDir + "/delinfo.txt")); System.IO.StreamWriter MyWriter = new StreamWriter(f.OpenWrite().ToString(),true,resEncoding,1000); tmpPath = Server.MapPath(RootDir +"/"+ Now_UserId.ToString() +"/"+ strDelPathInfo[i].ToString() + ".jpg"); if (File.Exists(tmpPath)) { try { MyWriter.Close(); File.Delete(tmpPath); } catch { MyWriter.WriteLine(tmpPath); MyWriter.Close(); } } 请问我用httpwebrequest去抓取某个网页代码 求一个算法?请多帮忙。。 问一个mail得正则表达式 我只想让在客户端页面只刷新一次(只一次)???? ArrayList绑定到DropDownLis C# 怎么编写验证码识别 在线等:问一个简单sql语句谢谢! 用C#在winform中做一个生成关系图的功能 c# 如何从数据库中读取保存的文件,直接打开,不保存到本地 简单问题,进来领分. 关于if的判断问题,有点难~~~~~~~~急~~~ 一个重复设置标签text属性的问题
System.IO.FileInfo f = new FileInfo(Server.MapPath(RootDir + "/delinfo.txt"));
System.IO.StreamWriter MyWriter = new StreamWriter(f.OpenWrite().ToString(),true,resEncoding,1000);
tmpPath = Server.MapPath(RootDir +"/"+ Now_UserId.ToString() +"/"+ strDelPathInfo[i].ToString() + ".jpg");
if (File.Exists(tmpPath))
{
try
{
MyWriter.Close();
File.Delete(tmpPath);
}
catch
{
MyWriter.WriteLine(tmpPath);
MyWriter.Close();
}
}