LinkTagHelper Class

Summary

@!:ITagHelper- implementation targeting <link> elements that supports fallback href paths.

Syntax

public class LinkTagHelper : TagHelper

GitHub

View on GitHub

class Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper

Constructors

LinkTagHelper(ILogger<Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper>, IHostingEnvironment, IMemoryCache, IHtmlEncoder, IJavaScriptStringEncoder)

Creates a new [Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper](Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.yml).

Arguments:
  • logger (ILogger{Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper}) – The <see cref=”!:ILogger&lt;ScriptTagHelper&gt;” />.
  • hostingEnvironment (IHostingEnvironment) – The @!:IHostingEnvironment-.
  • cache (IMemoryCache) – The @!:IMemoryCache-.
  • htmlEncoder (IHtmlEncoder) – The @!:IHtmlEncoder-.
  • javaScriptEncoder (IJavaScriptStringEncoder) – The @!:IJavaScriptStringEncoder-.
public LinkTagHelper(ILogger<LinkTagHelper> logger, IHostingEnvironment hostingEnvironment, IMemoryCache cache, IHtmlEncoder htmlEncoder, IJavaScriptStringEncoder javaScriptEncoder)

Properties

AppendVersion()

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

Return type:System.Nullable{System.Boolean}
public bool ? AppendVersion { get; set; }
Cache()
Return type:IMemoryCache
protected IMemoryCache Cache { get; }
FallbackHref()

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

Return type:System.String
public string FallbackHref { get; set; }
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 [Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.FallbackHrefInclude](Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.yml).

Return type:System.String
public string FallbackHrefExclude { get; set; }
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.

Return type:System.String
public string FallbackHrefInclude { get; set; }
FallbackTestClass()

The class name defined in the stylesheet to use for the fallback test. Must be used in conjunction with [Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.FallbackTestProperty](Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.yml) and [Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.FallbackTestValue](Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.yml), and either [Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.FallbackHref](Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.yml) or [Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.FallbackHrefInclude](Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.yml).

Return type:System.String
public string FallbackTestClass { get; set; }
FallbackTestProperty()

The CSS property name to use for the fallback test. Must be used in conjunction with [Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.FallbackTestClass](Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.yml) and [Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.FallbackTestValue](Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.yml), and either [Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.FallbackHref](Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.yml) or [Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.FallbackHrefInclude](Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.yml).

Return type:System.String
public string FallbackTestProperty { get; set; }
FallbackTestValue()

The CSS property value to use for the fallback test. Must be used in conjunction with [Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.FallbackTestClass](Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.yml) and [Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.FallbackTestProperty](Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.yml), and either [Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.FallbackHref](Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.yml) or [Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.FallbackHrefInclude](Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.yml).

Return type:System.String
public string FallbackTestValue { get; set; }
GlobbingUrlBuilder()
Return type:Microsoft.AspNet.Mvc.TagHelpers.Internal.GlobbingUrlBuilder
protected GlobbingUrlBuilder GlobbingUrlBuilder { get; set; }
HostingEnvironment()
Return type:IHostingEnvironment
protected IHostingEnvironment HostingEnvironment { get; }
Href()

Address of the linked resource.

Return type:System.String
public string Href { get; set; }
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 [Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.HrefInclude](Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper.yml).

Return type:System.String
public string HrefExclude { get; set; }
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.

Return type:System.String
public string HrefInclude { get; set; }
HtmlEncoder()
Return type:IHtmlEncoder
protected IHtmlEncoder HtmlEncoder { get; }
JavaScriptEncoder()
Return type:IJavaScriptStringEncoder
protected IJavaScriptStringEncoder JavaScriptEncoder { get; }
Logger()
Return type:ILogger{Microsoft.AspNet.Mvc.TagHelpers.LinkTagHelper}
protected ILogger<LinkTagHelper> Logger { get; }
ViewContext()
Return type:Microsoft.AspNet.Mvc.ViewContext
public ViewContext ViewContext { get; set; }

Methods

Process(TagHelperContext, TagHelperOutput)
Arguments:
  • context (TagHelperContext) –
  • output (TagHelperOutput) –
public override void Process(TagHelperContext context, TagHelperOutput output)