Any suggestions on how to do browser caching within a asp.net application. I've found some different methods online but wasn't sure what would be the best. Specifically, I would like to cache my CSS and JS files. They do change, however, it is usually once a month at the most.
For example a contact us page in a main page will be the same for all the users and for that there is no need to cache the entire page. So for that we prefer to use fragment caching option. For example: <%@ OutputCache Duration = 10 VaryByParam = "None" %>
Caching is a process in which data is kept in a cache. A cache is simply a storage area that stores data for a short time. Browser caching is a process that involves the temporary storage of resources in web browsers. A visitor's web browser downloads various website resources and stores them in the local drive.
Caching is the technique of storing the data which are frequently used. Those data can be served faster for any future or subsequent requests by eliminating the unnecessary requests to external data sources.
Use the SetNoStore() method as follows, in the ASPX page: <%@ Page Language=”C#” %> <% Response. Cache. SetNoStore(); Response. Write (DateTime.
Another technique is to stores you static images, css and js on another server (such as a CDN) which has the Expires header set properly. The advantage of this is two-fold:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With