South Dakota Code Camp

ASP.NET Core 1.0 Tag Helpers

Presented by: Robert Boedigheimer

ASP.NET Core 1.0 has introduced Tag Helpers which are a much more HTML-centric approach to using server-side code to help construct HTML elements in Razor views. ASP.NET will ship with built in tag helpers such as the “environment” that can include specific HTML (such as links to CSS or script tags) based on the level of server like development, stage, or production. Tag helpers provide specific attributes for elements like the “asp-fallback-*” attributes for automatic fallback to local resources when they are not available from a CDN. The “asp-append-version” used on URLs automatically appends a hash of the file contents to allow aggressive use of expirations for caching while forcing server requests when the files are modified. Besides the many tag helpers provided directly by ASP.NET, it is also possible to use third party tag helpers or create your own! This session will review a custom tag helper used to augment the lowly “img” tag to provide simple support for responsive images that delivers the most appropriate image for a particular device and use.