ASP.NET is quite a good framework for web applications. I enjoy working with it. Although it is not the only one I use, I have been building great things using it over the last couple of years.
Recently, a new Razor edition has been introduced under the name of Tag Helpers.
It aims at making the code more readable by not having to use Html Helpers when all we want is to create Form elements.
The picture above shows an ASP tag helper of type asp-action. This defines which action s the form going to execute. Another type of tag helper is the environment one, which can be used to configure our application in Development mode or not. The following figure shows it.
The code below will add the specified links if the application is running in Development mode. The environment tag acts as an if/else statement.
Here is the Html Helper for creating a label.
Here is the same label created using Tag Helpers.
We can see how the later is pretty clear.
We get the Tag Helpers referenced in our code, by convention, by having them added in the ViewImports.cshtml file as show below.
This ends part 1. Part 2 will show how to create your own Tag Helpers.
Source
Channel9 video – https://channel9.msdn.com/Shows/Web-Hack-Wednesday/Tag-Helpers-in-ASPNet-Core