Content directory with FilePathResult
I put the file need to return in the content folder. If I want to return the file, what the path to开发者_开发技巧 use? Is there anyway that MVC can find reources in the content folder?
No idea what content folder you are talking about but if we suppose that it is some sub directory:
public ActionResult Index()
{
return File(Server.MapPath("~/content/foo.txt"), "text/plain");
}
where ~
indicates the root of your web site.
精彩评论