0
我想以嵌套的方式創建文件夾。在c#中創建嵌套文件夾顯示訪問被拒絕錯誤
if (file.ContentLength > 0 && file != null)
{
string path = "~/Videos/" + Session["username"] + "_" + Session["userid"];
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
string filename = path + file.FileName;
filepath = "/Videos/" + Session["username"] + "_" + Session["userid"];
file.SaveAs(filename);
如果你看到這裏 - /Videos/
文件夾是我目前在磁盤上。在這個Videos
文件夾中,用戶名和ID是另一個文件夾是我想要創建的。我將如何在此文件夾內創建此文件夾?
因爲目前它顯示我這個錯誤 -
Access to the path '~/Videos/shaun_2' is denied.
我試圖重新啓動與管理員憑據的視覺工作室。但它仍然在這裏。