I am trying to include script files and css files inside view cshtml but i am getting 404 error because it's trying to get the files from a different path.
@{
ViewData["Title"] = "Index";
Layout = "_Layout_New";
}
@section Header{
<script src="dist/main.js"></script>
<link rel="stylesheet" href="dist/main.css" />
}
<div>
<div id="app"></div>
</div>
main.js and main.css are inside wwwroot folder. when i checked the network calls this is how it's trying to fetch request url https://localhost:44329/Controller/dist/main.js but i think it should make a call like this to get the file https://localhost:44329/dist/main.js
When i am trying to include this in Home/Index it's working because that's the root. Any ideas ?
~in the path, look at this answer or microsof doc~/points to the web root, you can get more information from here.