ASP.NET MVC 离线应用程序 url 问题
我有一个 MVC2 网站,我正在尝试在 iPhone 上离线工作。我网站中的所有页面都使用相同的母版页,并且它引用单个缓存清单文件。清单文件中不存在任何特定的 MVC url,但目前还可以,因为一旦访问过一次,它们就会被缓存(它们在初始下载时被缓存)。
我的问题是这样的:如果我有 www.mysite.com/red 或 www.mysite.com/blue 的 url,那么该页面将被缓存在 iphone 上。如果我的网址为 www.mysite.com/red/one 或 www.mysite.com/blue/two,则该页面不会被缓存。
有谁知道为什么会发生这种情况?
非常感谢。
I have an MVC2 web site which I am trying to get working offline on an iPhone. All pages in my site use the same master page, and this references the single cache manifest file. None of the specific MVC urls are present in the manifest file but that is ok for now because they will get cached once they have been visited once (they get cached on initial download).
My problem is this: if I have a url of www.mysite.com/red or www.mysite.com/blue then the page gets cached on the iphone. If I have a url of www.mysite.com/red/one or www.mysite.com/blue/two then the page does not get cached.
Does anyone know why this might be happening?
Thanks very much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
缓存清单中列出的文件的 URL 均与包含该清单的文件的位置相关,而不是与清单本身的位置相关。
如果您的网站结构如下:
并且您的cache.manifest当前看起来像
它将适用于www.mysite.com/red和www.mysite.com/blue。
要使相同的缓存清单适用于 www.mysite.com/red/one 或 www.mysite.com/blue/two,您应该更改清单以使用绝对网址,如下所示:
The url of the files listed in a cache manifest are all relative to the location of the file that includes the manifest, not the location of the manifest itself.
If your site is structured like:
And your cache.manifest currently looks like
It will work for www.mysite.com/red and www.mysite.com/blue .
To make that same cache manifest work for www.mysite.com/red/one or www.mysite.com/blue/two, you should change your manifest to use absolute urls, like this: