LinkTagHelper Class

Definition

ITagHelper implementation targeting <link> elements that supports fallback href paths.

public ref class LinkTagHelper : Microsoft::AspNetCore::Mvc::Razor::TagHelpers::UrlResolutionTagHelper
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElement("link", Attributes="asp-href-include", TagStructure=Microsoft.AspNetCore.Razor.TagHelpers.TagStructure.WithoutEndTag)]
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElement("link", Attributes="asp-href-exclude", TagStructure=Microsoft.AspNetCore.Razor.TagHelpers.TagStructure.WithoutEndTag)]
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElement("link", Attributes="asp-fallback-href", TagStructure=Microsoft.AspNetCore.Razor.TagHelpers.TagStructure.WithoutEndTag)]
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElement("link", Attributes="asp-fallback-href-include", TagStructure=Microsoft.AspNetCore.Razor.TagHelpers.TagStructure.WithoutEndTag)]
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElement("link", Attributes="asp-fallback-href-exclude", TagStructure=Microsoft.AspNetCore.Razor.TagHelpers.TagStructure.WithoutEndTag)]
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElement("link", Attributes="asp-fallback-test-class", TagStructure=Microsoft.AspNetCore.Razor.TagHelpers.TagStructure.WithoutEndTag)]
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElement("link", Attributes="asp-fallback-test-property", TagStructure=Microsoft.AspNetCore.Razor.TagHelpers.TagStructure.WithoutEndTag)]
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElement("link", Attributes="asp-fallback-test-value", TagStructure=Microsoft.AspNetCore.Razor.TagHelpers.TagStructure.WithoutEndTag)]
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElement("link", Attributes="asp-append-version", TagStructure=Microsoft.AspNetCore.Razor.TagHelpers.TagStructure.WithoutEndTag)]
public class LinkTagHelper : Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper
type LinkTagHelper = class
    inherit UrlResolutionTagHelper
Public Class LinkTagHelper
Inherits UrlResolutionTagHelper
Inheritance
Attributes

Remarks

The tag helper won't process for cases with just the 'href' attribute.

Constructors

LinkTagHelper(IHostingEnvironment, IMemoryCache, HtmlEncoder, JavaScriptEncoder, IUrlHelperFactory)

Creates a new LinkTagHelper.

LinkTagHelper(IHostingEnvironment, TagHelperMemoryCacheProvider, IFileVersionProvider, HtmlEncoder, JavaScriptEncoder, IUrlHelperFactory)

Creates a new LinkTagHelper.

LinkTagHelper(IWebHostEnvironment, TagHelperMemoryCacheProvider, IFileVersionProvider, HtmlEncoder, JavaScriptEncoder, IUrlHelperFactory)

Creates a new LinkTagHelper.

Properties

AppendVersion

Value indicating if file version should be appended to the href urls.

Cache

Gets the IMemoryCache used to store globbed urls.

FallbackHref

The URL of a CSS stylesheet to fallback to in the case the primary one fails.

FallbackHrefExclude

A comma separated list of globbed file patterns of CSS stylesheets to exclude from the fallback list, in the case the primary one fails. The glob patterns are assessed relative to the application's 'webroot' setting. Must be used in conjunction with FallbackHrefInclude.

FallbackHrefInclude

A comma separated list of globbed file patterns of CSS stylesheets to fallback to in the case the primary one fails. The glob patterns are assessed relative to the application's 'webroot' setting.

FallbackTestClass

The class name defined in the stylesheet to use for the fallback test. Must be used in conjunction with FallbackTestProperty and FallbackTestValue, and either FallbackHref or FallbackHrefInclude.

FallbackTestProperty

The CSS property name to use for the fallback test. Must be used in conjunction with FallbackTestClass and FallbackTestValue, and either FallbackHref or FallbackHrefInclude.

FallbackTestValue

The CSS property value to use for the fallback test. Must be used in conjunction with FallbackTestClass and FallbackTestProperty, and either FallbackHref or FallbackHrefInclude.

GlobbingUrlBuilder

Gets the GlobbingUrlBuilder used to populate included and excluded urls.

HostingEnvironment

Gets the IWebHostEnvironment for the application.

Href

Address of the linked resource.

HrefExclude

A comma separated list of globbed file patterns of CSS stylesheets to exclude from loading. The glob patterns are assessed relative to the application's 'webroot' setting. Must be used in conjunction with HrefInclude.

HrefInclude

A comma separated list of globbed file patterns of CSS stylesheets to load. The glob patterns are assessed relative to the application's 'webroot' setting.

HtmlEncoder (Inherited from UrlResolutionTagHelper)
JavaScriptEncoder

Gets the JavaScriptEncoder used to encode fallback information.

Order
SuppressFallbackIntegrity

Boolean value that determines if an integrity hash will be compared with FallbackHref value.

UrlHelperFactory (Inherited from UrlResolutionTagHelper)
ViewContext (Inherited from UrlResolutionTagHelper)

Methods

Init(TagHelperContext)

Initializes the ITagHelper with the given context. Additions to Items should be done within this method to ensure they're added prior to executing the children.

(Inherited from TagHelper)
Process(TagHelperContext, TagHelperOutput)
ProcessAsync(TagHelperContext, TagHelperOutput)

Asynchronously executes the TagHelper with the given context and output.

(Inherited from TagHelper)
ProcessUrlAttribute(String, TagHelperOutput)

Resolves and updates URL values starting with '~/' (relative to the application's 'webroot' setting) for output's Attributes whose Name is attributeName.

(Inherited from UrlResolutionTagHelper)
TryResolveUrl(String, IHtmlContent)

Tries to resolve the given url value relative to the application's 'webroot' setting.

(Inherited from UrlResolutionTagHelper)
TryResolveUrl(String, String)

Tries to resolve the given url value relative to the application's 'webroot' setting.

(Inherited from UrlResolutionTagHelper)

Applies to