Predefined Tag Helpers
Discover how to use predefined tag helpers in ASP.NET Core MVC to improve the functionality of HTML elements like anchors, images, scripts, and caching. Understand how to control caching strategies, append versioning to resources, and render content conditionally based on the environment. This lesson enables you to optimize web app performance and maintainability.
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 ...