diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/EnvironmentTagHelper.md b/aspnetcore/mvc/views/tag-helpers/built-in/EnvironmentTagHelper.md index 1178737479..9d072c58d2 100644 --- a/aspnetcore/mvc/views/tag-helpers/built-in/EnvironmentTagHelper.md +++ b/aspnetcore/mvc/views/tag-helpers/built-in/EnvironmentTagHelper.md @@ -1,20 +1,19 @@ ---- -title: Environment Tag Helper | Microsoft Docs +--- +title: Environment Tag Helper in ASP.NET Core author: pkellner description: ASP.Net Core Environment Tag Helper defined including all properties keywords: ASP.NET Core,tag helper ms.author: riande manager: wpickett -ms.date: 02/14/2017 +ms.date: 07/14/2017 ms.topic: article -ms.assetid: c045d485-d1dc-4cea-a675-46be83b7a035 ms.technology: aspnet ms.prod: aspnet-core uid: mvc/views/tag-helpers/builtin-th/EnvironmentTagHelper --- -# Environment Tag Helper +# Environment Tag Helper in ASP.NET Core -By [Peter Kellner](http://peterkellner.net) +By [Peter Kellner](http://peterkellner.net) and [Hisham Bin Ateya](https://twitter.com/hishambinateya) The Environment Tag Helper conditionally renders its enclosed content based on the current hosting environment. Its single attribute `names` is a comma separated list of environment names, that if any match to the current environment, will trigger the enclosed content to be rendered. @@ -34,6 +33,30 @@ An example of a valid `environment` tag helper is: ``` +## include and exclude attributes + +ASP.NET Core 2.x adds the `include` & `exclude` attributes. These attributes control rendering the enclosed content based on the included or excluded hosting environment names. + +### include ASP.NET Core 2.0 and later + +The `include` property has a similar behavior of the `names` attribute in ASP.NET Core 1.0. + +```html + + HostingEnvironment.EnvironmentName is Staging or Production + +``` + +### exclude ASP.NET Core 2.0 and later + +In constract the `exclude` property let the `EnvironmentTagHelper` to render the enclosed content for all hosting environment names except the one(s) that you specified. + +```html + + HostingEnvironment.EnvironmentName is Staging or Production + +``` + ## Additional resources *