我想顯示從網絡中的服務器位置的文本文件,但不起作用?顯示文件在asp.net mvc 2
public ActionResult ShowFile()
{
string filepath = Server.MapPath("\\some unc path\\TextFile1.txt");
var stream = new StreamReader(filepath);
return File(stream.ReadToEnd(), "text/plain");
}
爲什麼不呢?怎麼了? – SLaks 2011-05-09 14:39:07
不工作怎麼樣? – forsvarir 2011-05-09 14:39:29
你的反斜槓沒有得到保護。 – SLaks 2011-05-09 14:42:39