How can I replace the default UrlResolutionTagHelper with my own custom one?
``` C#
public class CustomUrlResolutionTagHelper : UrlResolutionTagHelper
{
public CustomUrlResolutionTagHelper(
IUrlHelperFactory urlHelperFactory,
HtmlEncoder htmlEncoder)
: base(urlHelperFactory, htmlEncoder)
{
}
public override void Process(TagHelperContext context, TagHelperOutput output)
{
base.Process(context, output);
output.Attributes.SetAttribute("custom", "true");
}
}
...
services
.AddMvc()
.AddTagHelpersAsServices();
services.AddTransient
...
```
Note: This does not require any additional @addTagHelper directives. It simply returns the CustomUrlResolutionTagHelper when the default one is requested.
@removeTagHelper Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor - This will remove the default@addTagHelper CustomUrlResolutionTagHelper, AssemblyWithMyCustomUrlResTagHelper - Add your own :smile: Thank you @NTaylorMullen !! excellent!
I suspect Url.Content will NOT use the custom CustomUrlResolutionTagHelper logic ?
Nope.
It also doesn't change URL resolution in subclasses -- the <img>, <link> and <script> tag helpers.
We are closing this issue because no further action is planned for this issue. If you still have any issues or questions, please log a new issue with any additional details that you have.