开发者

How html5 work in ASP.NET application?

Please give an example how I can integrate HTML code of offline caching in my ASP.Net applica开发者_如何学Ction?


http://stephenwalther.com/blog/archive/2011/01/26/creating-html5-offline-web-applications-with-asp-net.aspx

Set up your cache manifest handler like this

using System.Web;

namespace JavaScriptReference {

    public class Manifest : IHttpHandler {

    public void ProcessRequest(HttpContext context) {
        context.Response.ContentType = "text/cache-manifest";
        context.Response.WriteFile(context.Server.MapPath("Manifest.txt"));
    }

    public bool IsReusable {
        get {
        return false;
        }
    }
    }
}

and then add your manifest handler in the html5 tag

<html xmlns="http://www.w3.org/1999/xhtml" manifest="Manifest.ashx">


A better way to do this is to put the manifest content-type definition in your web.config under the system.webServer\staticContent tag.

  <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".manifest" mimeType="text/cache-manifest" />
    </staticContent>
  </system.webServer>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜