Disabling caching for critical web pages
Performance is one of the critical metrics for ASP.NET Core web applications. As developers, we find ways to make pages load faster, and the concept of caching resources and pages is nothing new. Browsers implement caching based on the Cache-Control directive they receive from the server. However, there is a risk associated with caching pages that contain sensitive data. We must selectively determine which pages are in danger of leaking information and disable caching from these pages.
Getting ready
We will be using the Online Banking app we used in the previous recipe. Using Visual Studio Code, open the sample Online Banking app folder at \Chapter04\cache-data\before\OnlineBankingApp\
.
You can perform the steps in this folder to disable caching on the Manage profile page.
How to do it…
Let's take a look at the steps for this recipe:
- From the starting exercise folder, launch Visual Studio Code by typing the...