-
Book Overview & Buying
-
Table Of Contents
Customizing ASP.NET Core 6.0 - Second Edition
By :
With Tag Helpers, you are able to extend existing HTML tags or create new tags that get rendered on the server side. The extensions or new tags are not visible in browsers. TagHelper are a kind of shortcut to write easier (and less) HTML or Razor code on the server side. TagHelper will be interpreted on the server and produce "real" HTML code for browsers.
TagHelper are not a new thing in ASP.NET Core. They have been present since the framework's first version. Most existing and built-in TagHelper are a replacement for the old-fashioned HTML helpers, which still exist and work in ASP.NET Core to keep the Razor views compatible with ASP.NET Core.
A very basic example of extending HTML tags is the built-in AnchorTagHelper:
<!-- old fashioned HtmlHelper -->
@Html.ActionLink("Home", "Index", "Home")
<!-- new TagHelper -->
<a asp-controller="Home" asp-action="Index">Home<...