ASP.NET 响应过滤和缓存后替换不兼容
根据这篇文章 http://support.microsoft.com/kb/2014472 你可以'不要同时使用响应过滤器和替换控件。有没有人找到解决方法?我正在尝试在将完整的 HTML 响应写入客户端之前对其进行处理,并且我确实广泛使用替换控件。
According to this article http://support.microsoft.com/kb/2014472 you can't use Response filters and Substitution controls together. Has anyone found a workaround for this? I am trying to process complete HTML response just before it's written to client and I do use substitution controls widely.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下是 MS 开发支持对此问题的官方“答复”。
问题:
在以下情况下,ASP.NET 中用于修改由另一个进程呈现的 HTML 的响应过滤的替代方法是什么:
1.其他进程不能修改
2、必须支持缓存后替换
答案:
“是的,你的问题很清楚,官方声称不支持。因为后缓存替换会将某些替换块组合到响应字节,而响应过滤期望过滤响应的原始字节(未修改)因此,之前组合的替换块无法再保留,
到目前为止,微软还没有其他选择。”
Here's an official "answer" from MS Dev Support on this issue.
Question:
What is the alternative to response filtering in ASP.NET for modifying HTML rendered by another process when:
1. The other process cannot be modified
2. Post-cache substitution must be supported
Answer:
"Yes, you question is clear as blue sky and this is officially claimed to be not support. As Post-cache substitution would combine certain substitution chunks to the response bytes while response filtering expects to filter the raw bytes of the response(not modified). So the previously combined substitution chunks cannot be preserved anymore.
There is not an alternative from Microsoft so far."
您引用的页面有解决方案:
在使用替换块的页面上禁用输出缓存。
编辑
可能的解决方案:
创建所有非动态内容的母版页。缓存那个。不要缓存更改的内容。
The page you reference has the solution:
Disable output caching on pages that are using substitution blocks.
Edit
Possible solution:
Create master pages of all non-dynamic content. Cache that. Don't cache the changing content.