Skip to main content

Posts

Showing posts with the label cache CSS

How to implement cache to rendering CSS and JS file in MVC C#

The below code will help us to  implement cache to render CSS and JS files in MVC C# and also to improve the performance of page loading. The following steps: 1)      Added a Cache Helper class to Cache file, 2)      Import the Utility on cshtml file 3)      Apply the CacheHelper.CacheFile() for each js and css file on views 4)      Result For Example,>  Added a Cache Helper class to Cache file, using System; using System.IO; using System.Web; using System.Web.Caching; using System.Web.Hosting; namespace Utility {     public static class CacheHelper     {                public static string CacheFile( string rootRelativePath)         {              if (HttpRuntime.Cache[rootRelativ...