我正在开发一个我们为用户生成文件夹的项目,我的问题是,是否可以在代码后面创建一个特定用户作为管理员的文件夹?
if (!Directory.Exists(Server.MapPath("~/Files/" + compamyFolder + "/User/" + folder)))
{
Directory.CreateDirectory(Server.MapPath("~/Files/" + compamyFolder + "/User/" + folder));
}
答案 0 :(得分:-1)
根据http://forums.asp.net/p/1226236/2209871.aspx使用以下代码:
string subPath ="ImagesPath"; // your code goes here
bool isExists = System.IO.Directory.Exists(Server.MapPath(subPath));
if(!isExists)
System.IO.Directory.CreateDirectory(Server.MapPath(subPath));
快乐的编码!!
答案 1 :(得分:-1)
怎么样
string folderPath = @"C:\myRootFolder";
if(!Directory.Exists(folderPath))
{
Directory.CreateDirectory(folderPath);
}