Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vNext MVC Template - wwwroot

Tags:

asp.net-core

I created vNext MVC Template then created a folder named images under wwwroot. I call like this:

<img src="~/wwwroot/images/album/1.jpg" />

But, the image is not loading. How can I reach that image?

like image 339
fatihyildizhan Avatar asked Nov 14 '14 11:11

fatihyildizhan


1 Answers

Putting this as an answer with more details so that others will see.

The wwwroot folder in the app is the root of the static, servable files. As such, wwwroot does not appear in the URLs. Take a look at the project.json file to see where that comes into play:

{
    ...
    "webroot": "wwwroot",
    ...
}

This is telling ASP.NET vNext that static files (the "webroot") are located in the wwwroot sub-directory. This is the default location where the Static File middleware will return files from.

like image 109
Eilon Avatar answered Sep 20 '22 17:09

Eilon