How do I configure the style background-image url to the absolute path of the image
<div style="background-image:url('~/images/department/@Model.DepartmentImage'); width:128px; height:128px">
<div>@Html.Raw(Model.ImageMap)</div>
</div>
How do I configure the style background-image url to the absolute path of the image
<div style="background-image:url('~/images/department/@Model.DepartmentImage'); width:128px; height:128px">
<div>@Html.Raw(Model.ImageMap)</div>
</div>
A separate class in an external stylesheet is cleaner (and the path will be relative to the stylesheet).
However, you can use Url.Content('~/images/department/" + Model.DepartmentImage )
inside your view to return the complete, resolved path.
Note that this isn't an absolute URL (details), but based on your example syntax you are looking for the URL to be resolved to the application root, regardless of where in the directory hierarchy the URL is output.