开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜