EnvironmentTagHelper Class

Definition

ITagHelper implementation targeting <environment> elements that conditionally renders content based on the current value of EnvironmentName. If the environment is not listed in the specified Names or Include, or if it is in Exclude, the content will not be rendered.

public ref class EnvironmentTagHelper : Microsoft::AspNetCore::Razor::TagHelpers::TagHelper
public class EnvironmentTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
type EnvironmentTagHelper = class
    inherit TagHelper
Public Class EnvironmentTagHelper
Inherits TagHelper
Inheritance
EnvironmentTagHelper

Constructors

EnvironmentTagHelper(IHostingEnvironment)

Creates a new EnvironmentTagHelper.

EnvironmentTagHelper(IWebHostEnvironment)

Creates a new EnvironmentTagHelper.

Properties

Exclude

A comma separated list of environment names in which the content will not be rendered.

HostingEnvironment

Gets the IWebHostEnvironment for the application.

Include

A comma separated list of environment names in which the content should be rendered. If the current environment is also in the Exclude list, the content will not be rendered.

Names

A comma separated list of environment names in which the content should be rendered. If the current environment is also in the Exclude list, the content will not be rendered.

Order

When a set of ITagHelpers are executed, their Init(TagHelperContext)'s are first invoked in the specified Order; then their ProcessAsync(TagHelperContext, TagHelperOutput)'s are invoked in the specified Order. Lower values are executed first.

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)

Synchronously executes the TagHelper with the given context and output.

ProcessAsync(TagHelperContext, TagHelperOutput)

Asynchronously executes the TagHelper with the given context and output.

(Inherited from TagHelper)

Applies to