How to do it...

We'll add the manifest file to enable the cache on the client side, and configure which files will be cached and which files will not.

Let's start by including the manifest file with the relative path as follows:

<!DOCTYPE html> 
<html manifest="mySite.appcache"> 

Or with an absolute path:

<html manifest="http://www.mywebsite.com/mySite.appcache" 

First of all, let's analyze the anatomy of a cache manifest file:

CACHE MANIFEST 
# version 1.0 
  • CACHE:
/Content/Styles/Site.css 
/Content/Scripts/Site.js 
http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.2.0.js
  • NETWORK:
/Login/ 
Network.html 
  • FALLBACK:
/Content/Images/Products/  

The CACHE MANIFEST section is only here to add comments (about the version, for example).

The three sections ...

Get ASP.NET Core MVC 2.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.