如何在mvc5多应用程序项目中引用另一个项目文件夹中的图像 [英] How do I references images in another project folder in mvc5 multiple application project

查看:92
本文介绍了如何在mvc5多应用程序项目中引用另一个项目文件夹中的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Everyone,



我有mvc 5多个项目(Project1和项目2)我上传图片并保存在项目1中的images文件夹中,我想要能够从项目2视图中引用项目1图像文件夹中的图像。



谢谢



我尝试了什么:



< img src =@ Url.Content(〜/ OnlineStore / images / ProductFrontView / S- N62655_DSC0040.JPG)>



其中Onlinestore是项目的名称。

解决方案

项目是Visual Studio中的一个概念,它对互联网,网站或http没有任何意义。



如果这个项目不同在不同主机下的网站,你只能真正硬编码图像的路径,也许把域放在配置文件中,这样你就可以改变它,但图像网址需要完全合格;



http://www.othersite.com/OnlineStore/Ima GES / blah.jpg

Hello Everyone,

I have mvc 5 multiple projects (Project1, and project 2) i am uploading images and save in images folder in project 1, i want to be able to reference the images in project 1 images folder from project 2 view.

Thanks

What I have tried:

<img src="@Url.Content("~/OnlineStore/images/ProductFrontView/S-N62655_DSC0040.JPG")">

Where Onlinestore is the name of the project.

解决方案

A "Project" is a concept in Visual Studio, it doesn't mean anything in terms of the internet, or websites or http.

If this project is a different site under a different host then you can only really hard-code the path to the images, maybe put the domain in a config file so you can change it, but the image urls will need to be fully qualified;

"http://www.othersite.com/OnlineStore/Images/blah.jpg"


这篇关于如何在mvc5多应用程序项目中引用另一个项目文件夹中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆