Search code examples
cssasp.netvisual-studio-2017

Different result when debug and publish ASP.Net MVC


I'm developing website with ASP.Net and get some problem. The different result when I debug and publish the project. Its like the css and image not synchronized.

Debug Version (IIS Express): enter image description here

Publish Version (Using IIS Manager Windows 10): enter image description here

I'm using this code:

<div class="img" style="background-image: url(../../images/png/007-pray.png);"></div>

the image not showing off. and some edited css not changed in some page. (its like 2 different kind of file that I publish)

Am I missing something when run the web app? the solution manager is set to debug version for both debug and publish version.

need help.

Thanks in advance.


Solution

  • I found the problem is...

    this is the path where I publish my webapp. C:\inetpub\wwwroot\alumnipmkmaranatha

    when I check path for the image folder, the folder 'alumnipmkmaranatha' is not included. Then I checked to my IIS Manager: I put 2 web app in default web app.

    So if I use <img src="~/ImagesFolder/Imagename.png" /> it goes to 'wwwroot' folder, not 'alumnipmkmaranatha'

    Thanks to AbdulHannah