Offline Web Applications
Firstly the path to the .manifest file needs to be included in the HTML element at the top of the page.
<html lang=”en” manifest=”offline.manifest”>
For an MVC site, simply add the reference to the manifest in the _Layout file and add each resource you want in the browser application cache.
These resources above are used for the standard MVC template you get with Visual Studio 2015.
Now to get IIS to serve up this offline.manifest file you either have to add a mime type on the server or add it to the <system.webserver> element in web.config.
Its important that you add the clear element and you need then to add the usual types your site will serve up other wise you will get an HTTP 500 on each of these.
In Chrome when browsing to this page you can examine the Application Cache by going to the developer tools (F12) and going to the Resources tab.
Make sure that the ‘Disable cache’ check box is cleared as by default it is checked when you open up the developer tools and the browser will not retrieve the files needed from the cache.
The main issue with the .manifest file is the browser does not know when the contents listed in it have changed unless the time stamp on the manifest itself has changed. One way to do this is to version the file and an even better way is to version it by using your application build number.
There are many issues with MVC serving up a .manifest file and the easiest solution I have found is to write out a physical file to the location the site is hosted in like this.
Which can be placed inside the Home/Index controller. Then add the path to the _Layout file like this.
<html lang=”en” manifest=”/Manifest/offline.manifest”>
You will need to add write permissions to this directory for the IIS account so it can delete and write the file. Now if your build number increments each time you do a build and deploy, the manifest file will be regenerated and the client browser will pick up any changes.