Reputation: 830
So, I have an image on my computer. I make an html-page with simple code, src="file:\\\C:\...\file.png"
It's ok, image is shown.
Then I write the same code in mvc-view. Image isn't shown, firebug shows gray img code.. I have seen some tips about Url.Content, but they didn't help..
Upvotes: 0
Views: 1722
Reputation: 15400
If you create an HTML file on your disk and open it in a browser (with a URL such as file:///mypage.html), then it can serve images straight from your hard disk (I believe) and no Web server is involved.
But once you start using ASP.NET, then you are no longer viewing through a file URL, but through a local web server (e.g. http://localhost/mypage
) and only images that are deployed on your web server can be served. That can still easily be done, drag and drop images into your Visual Studio solution.
Upvotes: 2