我正在使用streamwriter来编写文件,但是新编写文件的位置位于项目文件夹中的一个文件夹中,但我希望该位置位于计算机的文档库中。即时通讯使用mvc应用程序而不是控制台应用程序
任何帮助都会受到赞赏。
谢谢
using (var File = new StreamWriter(System.Web.HttpContext.Current.Server.MapPath("~/OutputFileTest.csv"), false)) // true for appending the file and false to overwrite the file
{
foreach (var item in outputFile)
{
File.WriteLine(item);
}
}
答案 0 :(得分:0)
来自MSDN:
// Sample for the Environment.GetFolderPath method
using System;
class Sample
{
public static void Main()
{
Console.WriteLine();
Console.WriteLine("GetFolderPath: {0}",
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
}
}
/*
This example produces the following results:
*/