UrlHelper.Content
overload that accepts an appendVersion
argument
#57964
Labels
area-mvc
Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
I am trying to declare an import map in my web application. So in
_Layout.cshtml
I will write something like:However, this does not get the benefits of
asp-append-version
, and the way to achieve the same result asasp-append-version
is not obvious.Describe the solution you'd like
Currently, the
ImageTagHelper
,LinkTagHelper
, andScriptTagHelper
all privately re-implement this same method:aspnetcore/src/Mvc/Mvc.TagHelpers/src/ImageTagHelper.cs
Lines 140 to 158 in d05f358
aspnetcore/src/Mvc/Mvc.TagHelpers/src/LinkTagHelper.cs
Lines 532 to 551 in d05f358
aspnetcore/src/Mvc/Mvc.TagHelpers/src/ScriptTagHelper.cs
Lines 412 to 430 in d05f358
I think these should be deduplicated into a single implementation. Perhaps
UrlHelper
itself could contain this bit of logic and expose it viaUrlHelper.Content(contentPath, appendVersion)
, or perhaps it would be better encapsulated by some new service type which could then also be used byUrlHelper.Content(contentPath, appendVersion)
.Either way, I would really like to see
UrlHelper.Content(contentPath, appendVersion)
.Additional context
No response
The text was updated successfully, but these errors were encountered: