4
我想寫使用下面的代碼使用ASP.NET 4.5 with c#
一個文本文件:不能在Web應用程序中找到路徑
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"./Experiment/main.txt", true))
{
file.WriteLine(DateTime.UtcNow.ToString() + " test");
}
而且我得到這個異常:
"Could not find a part of the path 'C:\Windows\SysWOW64\inetsrv\Experiment\main.txt'."
文件夾Experiment
是我的web應用程序的文件夾。
,它使用的工作目錄是不是你的Web根目錄,這是你的IIS運行的位置。 – Tobberoth