开发者

Content directory with FilePathResult

开发者 https://www.devze.com 2023-01-25 22:45 出处:网络
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 co

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

精彩评论

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