I created a simple test ASP.NET MVC application trying to use the Application Cache. Chrome seems to work fine, however in IE 10/11, it is giving us the following messages when trying to download the cache. Any ideas or sample where this is working?
I have tried a number of things including a smaller file to download. I saw there is a limit that can cause a similar error.
Manifest
CACHE MANIFEST
#VERSION 9
CACHE:
/Content/site.css
NETWORK:
*
FALLBACK:
Index View
@{
Layout = null;
}
<!DOCTYPE html>
<html manifest="home/manifest">
<head>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE" />
<meta http-equiv="EXPIRES" content="0" />
<meta http-equiv="PRAGMA" content="NO-CACHE" />
<title>Offline Test</title>
<link rel="Stylesheet" href="/Content/site.css"
type="text/css" />
<script src="/Scripts/jquery-1.10.2.min.js"
type="text/javascript"></script>
<script>
$(function () {
});
</script>
</head>
<body>
</body>
</html>
MVC Controller
[OutputCache(Duration = 0, NoStore = true)]
public class HomeController : Controller
MVC Action
public ContentResult Manifest()
{
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
return new ContentResult
{
ContentType = "text/cache-manifest",
Content = RenderPartialViewToString("Manifest"),
ContentEncoding = System.Text.Encoding.UTF8
};
// Doesn't work. Content type is still html
//Response.ContentType = "text/cache-manifest";
//Response.ContentEncoding = System.Text.Encoding.UTF8;
//Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
//return PartialView();
}
I tried adding a SetNoStore() call in the Application_EndRequest handler but it didn't make any difference.
public override void Init()
{
base.Init();
EndRequest += Application_EndRequest;
}
private void Application_EndRequest(object sender, EventArgs e)
{
HttpContext.Current.Response.Cache.SetNoStore();
}
Thanks!
Remove the no-store
in the Cache-Control
-Header, it breaks the appCache in IE10/IE11 (see https://stackoverflow.com/a/21272714/1039180).