Images not getting loaded when Website deployed to IIS

asp.net-mvc-4, iis-7

Solution

Add the ~ sign in your path to the image.

<img src="@Url.Content("~/Images/greenDot.png")" style="margin-right: 10px;"/>

If you have authentication in your website, check if the path to the folder has public rights. You must do this in your web.config.

Problem

The images used in the website are stored here (in the Images folder) - And the images are referenced this way - ``` <img src="@Url.Content("/Images/greenDot.png")" style="margin-right: 10px;"/> ``` When I run the website on my local machine, all the images get loaded fine. But when I deploy it on IIS and run that website none of the images get loaded. Errors - ``` Failed to load resource: the server responded with a status of 404 (Not found) http://54.234.60.214/Images/Logo_Innosolv.jpg Failed to load resource: the server responded with a status of 404 (Not Found) http://54.234.60.214/Images/Icons/bid.png ``` What seems to be the problem? Do I move the images to some other folder or do I change the way I reference them in the views?

Original source