URL压缩 +响应过滤器冲突
我的 IIS 7.5 启用了动态内容的 URL 压缩。我想添加一个响应过滤器来删除修改渲染的 html,由于某种原因,我在过滤时不断收到垃圾数据。
响应过滤器写入方法的代码如下:
Encoding encoding = HttpContext.Current.Response.ContentEncoding;
string html = encoding.GetString(buffer);
html = regFindFollow.Replace(html, new MatchEvaluator(AddFollowNoFollowAttribute));
byte[] outdata = encoding.GetBytes(html);
当我从 Web 配置中删除 URL 压缩时,该方法开始工作。我在这里错过了什么吗?是否有可以指定的响应过滤器的顺序?
我正在使用的配置是
<urlCompression doDynamicCompression="true" dynamicCompressionBeforeCache="true" />
I have IIS 7.5 with URL compression enabled for dynamic content. I wanted to add a response filter to remove modify the rendered html and for some reason I kept getting garbage data while filtering.
The code for the response filter's write method is below:
Encoding encoding = HttpContext.Current.Response.ContentEncoding;
string html = encoding.GetString(buffer);
html = regFindFollow.Replace(html, new MatchEvaluator(AddFollowNoFollowAttribute));
byte[] outdata = encoding.GetBytes(html);
This starts to work when I remove URL compression from web config. Am I missing something here? Is there an order for response filters that can be specified?
Config I am using is
<urlCompression doDynamicCompression="true" dynamicCompressionBeforeCache="true" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更改配置
修复了此问题。我想在执行模块期间收到压缩的 html 并且无法解析它。
Changing the config with
Fixed this. I suppose during the execution module received compressed html and couldn't parse it.