2

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?

IE AppCache Fatal Errors

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!

MikeDouglasDev
  • 1,331
  • 10
  • 22
  • it looks like to me the server is not returning anything, a 404, to the root file request. The appCache requests are not logged in the network tab AFAIK. Open up fiddler and see if the request is made and what happens. If that does not help then set a break point in your MVC controller to see if the content is requested and what happens. My guess is there is Chrome is probably failing too, but does not let you know. – Chris Love Jun 03 '14 at 10:42

1 Answers1

4

Remove the no-store in the Cache-Control-Header, it breaks the appCache in IE10/IE11 (see https://stackoverflow.com/a/21272714/1039180).

Community
  • 1
  • 1
Robin
  • 538
  • 1
  • 3
  • 13