0
votes

I'm generating my cache manifest on the fly in a handler, setting the content type to "text/cache-manifest". However when i'm loading my cached page in Chrome i get the following error in Chrome's console (note empty string in brackets), and the files are never updated:

Application Cache Error event: Invalid manifest mime type () http://localhost:4010/WebClient/CacheManifest.ashx

This was working fine before for almost a year, and how suddenly started happening.

Any ideas?

Here's the code-behind for CacheManifest.ashx:

public class CacheManifest : IHttpHandler
{
    public bool IsReusable
    {
        get
        {
            return true;
        }
    }

    public void ProcessRequest(HttpContext context)
    {
        HttpResponse response = context.Response;
        response.Clear();
        response.ContentType = "text/cache-manifest";

        StringBuilder output = new StringBuilder();

        output.AppendLine("CACHE MANIFEST");
        output.AppendLine();
        output.AppendLine("CACHE:");

        // here's the code that loads files from disk and adds to manifest.

        // allow online resources
        output.AppendLine("NETWORK:");
        output.AppendLine("*");

        output.AppendFormat("# hash: {0}", GetContentHash());

        response.Write(output.ToString());
    }
}
1

1 Answers

0
votes

Base on my testing, it's due to localhost. The web browser is no able to download it from localhost. When I do a deployment to production (real webserver in the web), it works flawlessly.