您的位置:首页 > 编程语言 > C#

c#常用文件操作

2017-11-17 12:14 183 查看
1.Web 获取绝对路径

string filePath = HttpContext.Current.Server.MapPath("~/EmailFiles/"+m.ms_username);

线程中:HttpRuntime.AppDomainAppPath.ToString();

From 

Application.StartupPath.ToString();

2.判断路径不存在 就 创建

 System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(filePath);

if (!dir.Exists) dir.Create();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: