Predefined Tag Helpers
In this lesson, we will learn how to use all ASP.NET Core Razor predefined tag helpers.
ASP.NET Core predefined tag helpers include tag helpers for enhancing links, caching view and page areas, improving image tags, script tags, and specifying different content in development and production. We will describe each of them in a dedicated section.
All predefined tag helpers are defined in the Microsoft.AspNetCore.Mvc.TagHelpers
dll that is part of the .NET Core runtime. These tag helpers are automatically added in the _ViewImports.cshtml
files that are created in the Views and Pages folders when an ASP.NET Core MVC /ASP.NET Core Pages project is generated either with Visual Studio or with the dotnet
.NET Core SDK command-line tool.
The anchor tag helper
We have already seen how the anchor tag helper works in the previous lesson. It is applied on every a
tag having an asp-action
attribute. Together with the asp-action
and asp-controller
attributes it may also have other attributes for specifying all parameters of the routing rule. These attributes have names like asp-route-{paramater name}
. Thus, for instance, if we are ...