且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

内容文件夹中文件的路径(ASP.NET MVC)

更新时间:2022-11-25 10:34:12

1.Content文件夹是根文件夹吗? 我的意思是 http://localhost/指向 内容还是其他?

1.Is the Content folder the root folder? I mean does http://localhost/ point to Content or is it something else?

否, http://localhost:port/不指向内容文件夹.您可以通过 http://localhost:port/content/ ...

访问内容文件夹中的文件>

No, http://localhost:port/ does not point to content folder. You can access files in content folder through http://localhost:port/content/...

2.我有一个名为dummyIcon.png的文件 在Content/images/temp文件夹中.如何 我可以从我的域层找到它吗 (这是一个代码库项目)?

2.I have a file named dummyIcon.png inside Content/images/temp folder. How do I locate it from my domain layer (which is a Code Library project)?

您应该能够以 http://localhost:port/Content/访问images/temp/dummyIcon.png

3.什么是***实践 在ASP.NET MVC中显示图像? 我应该在其中存储图像的路径吗 数据库(我个人 首选),还是我保存一个字节数组,然后 返回视图?

3.What is the best practice of displaying images in ASP.NET MVC? Should I store a path to the image in the database (which I personally prefer), or do I save a byte array and return it to the view?

存储图像的位置取决于您的应用程序需求.这些通用图像是否用于显示应用程序图像(图标,公司徽标等).那么***将它们存储在文件系统中.

Where you store the images depends on your application needs. Are these generic images that is used to display application images (icons, company logo, etc).. Then it is best to store them in file system.

如果您的应用程序处理图像,并且您从事图像存储,操作等工作,那么您可能需要DB.我认为,存储在Web应用程序上使用的图像是一项开销.

If your application deals with images and you work on storing images, manipulation etc, then you may need DB. I think, storing images used on the web application is a overhead.