Arash
Arash

Reputation: 4260

Images under "image/subfolder" cannot be found in the latest Razor Engine - MVC.NET

I am having a hard time in making images in my MVC.NET web application developed in Visual Studio 2012. To keep the story short, please take a look at the following two lines of code:

<img [email protected]("~/Content/themes/construct/images/MyPic1.png") />
<img [email protected]("~/Content/themes/construct/images/blog/MyPic2.png") />

Both MyPic1.png and MyPic2.png files do exist. However when rendering the page, the first picture which is MyPic1.png is shown but the second one which is found under "blog" subfolder does not show up. I used FireBug and it did not show any error messages!

What could be wrong and how to resolve it?

Upvotes: 3

Views: 1298

Answers (1)

Dilli Babu
Dilli Babu

Reputation: 129

There is nothing wrong with your razor code, I did create the folder structure as you mentioned, both the images are loading as expected.

I suspect you might not have the correct file extension.

Explore the file, click Organize -> select Folder and search option -> select File (tab) -> uncheck 'Hide Extension for known file types' as given in below diagram and see the image extension.

enter image description here

Some time we save image with 'pic1.png.png' or 'pic1.png.jpg'.

Upvotes: 1

Related Questions