Click here to Skip to main content
15,906,081 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 5-Jul-16 0:48am

1 solution

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"
 
Share this answer
 
Comments
Uwakpeter 5-Jul-16 7:38am    
the two applications are in the same project but each of them have web.config file and solution file
F-ES Sitecore 5-Jul-16 8:21am    
Again what they are at a project level is irrelevant. What counts is how they are deployed. Anyway, chances are you're just going to have to hard-code the paths as I said.
Uwakpeter 5-Jul-16 8:32am    
i tried hard coding the path like this: <img src="@Url.Content("~/OnlineStore/images/ProductFrontView/S-N62655_DSC0040.JPG")"> but the image was not displaying
F-ES Sitecore 5-Jul-16 8:39am    
That will generate a url relative to the current site, if your files are on a different site you can't use Url.Content

<img src="http://yoursite.com/OnlineStore/images/ProductFrontView/S-N62655_DSC0040.JPG">

Again this all depends on how you are deploying the sites which you have still failed to answer.
Uwakpeter 5-Jul-16 9:18am    
i am planning to deploy both application into same server running on the same domain name, one is for admin section while the other is for frontend

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900