In this article we will discuss Why asp-append version Feature used in ASP.NET Core.
Here we discuss why asp-append version Feature used in ASP.NET Core.
Before start this article, please visit our previous article IWebHostEnvironment in ASP.Net Core
We often use CSS and JS files for our website, the problem every time you update the CSS, JS file, the user side doesn't automatically download the new version.
To solve the problem of downloading new version css and js files, we usually clear the cache or press the refresh button. This is annoying for the user.
The good news is that ASP.NET Core has a solution to this problem. You can use asp-append-version="true"
To turn this feature ON, we just need to add the above special attribute to the HTML tag of the JS, CSS or Image file as shown below.
CSS
JS
When you run the web page, open the html source, you can see the following. Just right click on your web, then select Inspect or you can press Ctrl + U.
CSS & JS
Now every time you update the css or js file, the browser will automatically download the new version of the css or js file to the user's computer. So it means there's no need to use Ctrl + F5 or Ctrl + R to refresh the web page.
Summary
Post a Comment