'"~" and "/" Not giving the root folder on asp.net-mvc
On a shared view (like _layout.cshtml), I'm asking for the root folder in many ways ("/Content/design.css", @Url.Content("~/Content/design.css") ) But I'm always getting the controller name and then the requested url ("localhost:3333/MyControllerName/Content/design.css")
Why?
I'm running my project on IIS express.
This is the problematic line:
<link rel="stylesheet" href="@Url.Content("~/Content/design.css")" />
also tried:
<link rel="stylesheet" href="@Url.Content("/Content/design.css")" />
Solution 1:[1]
not sure if you fixed this, I know I'm late, can you try this?
I'm thinking you don't need @Url.Content
<link href="~/Content/design.css" rel="stylesheet" />
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Salvatore Leto |
