I am currently adding ?t=@(DateTime.Now.ToString("yyyyMMddHHmmss"))
to every single js or css file in my project to update the cache automatically. Is there a way to make a c# method that will do that for me everytime i use a new js and/or css ?
Asked
Active
Viewed 303 times
1

Arly C.
- 35
- 6
-
2are you using core? https://www.c-sharpcorner.com/blogs/aspappendversion-feature-in-asp-net-core – Bryan Dellinger Oct 14 '20 at 00:33
-
@BryanDellinger That looks like exactly what i need. Sadly, i am not using Core... is there a similar solution for non core users ? – Arly C. Oct 14 '20 at 00:50
-
1the answer [here](https://stackoverflow.com/questions/5818799/autoversioning-css-js-in-asp-net-mvc) provides a decent way to implement this. BTW, what you are doing is called versioning, that may help you in searching – Jonesopolis Oct 14 '20 at 01:31