日期:2014-05-17  浏览次数:20427 次

ASP.NET MVC3中如何创建文件夹
string mapPath=Server.MapPath("/image/newDir");
if (!Directory.Exists(mapPath)) {
  Directory.CreateDirectory(mapPath);
}

这样为什么创建不了文件夹?

------解决方案--------------------
你看看 mapPath 对应的绝对路径的权限是否分配了。
------解决方案--------------------
你为啥不在这个外边加一层try{}catch{}呢?看看错误信息。