-1

I made a small web application on ASP.net MVC, everything was working fine until I recently migrated project from my old laptop to new laptop.

The problem is that the images on the webpages are no longer visible. I think problem is somewhere in the configuration. Below is my application's homepage.

My application's home page.

When I inspect elements and see the path of the image, the path is correct. Please let me know where I am doing wrong or there is something else that I am forgetting.

Below is the part of the view which I have shown below:

<div class="col-md-4">
    <div class="media">
        <p class="media-left" style="text-align:center">
            <img src="~/Content/Images/app_icon.png" class="img64by64" alt="" />
        </p>
        <div class="media-body" style="text-align:center">
            <h4 class="media-heading">Download amazing apps</h4>
            Download apps you like & get rewarded.
        </div>
    </div>
</div>

Also, when I go to localhost/FreeCube/Content/Images/banner.png on my browser, the image banner.png was displayed on my old laptop, but it is not displayed on new one, do I need to do some configurations in IIS?

Alok Gupta
  • 1,353
  • 1
  • 13
  • 29
  • use `@Url.Content()` helper in order to give path to your image tags instead of static paths. – Kartikeya Khosla Mar 25 '16 at 06:24
  • Please see the update, the code is a part of above displayed image, I was using static paths and it was working fine, why is that not working now? – Alok Gupta Mar 25 '16 at 06:27
  • http://stackoverflow.com/questions/22620253/asp-net-mvc-actionlink-vs-redirecttoaction-for-images-in-areas?rq=1 – Mohit Verma Mar 25 '16 at 06:30
  • @MohitVerma this is what I get when I try it: Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS1061: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'Content' and no extension method 'Content' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?) – Alok Gupta Mar 25 '16 at 06:33
  • This answer solved my issue : http://stackoverflow.com/questions/10512053/css-images-js-not-loading-in-iis – Alok Gupta Mar 25 '16 at 07:04

2 Answers2

0

Go to Nuget Manager and reinstall ASP.NET MVC or update it to a higher version. You can also do this from Package Console with the following command

Install-Package Microsoft.AspNet.Mvc
0

This answer solved my issue : stackoverflow.com/questions/10512053/…

I needed to enable static content in Turn windows feature on or off. It resolved my issue.

Alok Gupta
  • 1,353
  • 1
  • 13
  • 29