如何从服务器响应中删除空格和换行符? [英] how to remove spaces and newlines from server response?

查看:170
本文介绍了如何从服务器响应中删除空格和换行符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用浏览器/ AJAX请求请求页面时,我看到很多空格和换行符,我认为必须增加一些检索响应的开销,因为它们也属于字符意味着字节和大小。对吗?

When i request a page using browser / AJAX request i see lot of spaces and newlines which i think must be adding some overhead for retrieving the response as they too belong to characters means bytes and size. right ?

从服务器发送时有什么方法可以删除吗?怎么样 ?
(我正在使用IIS和asp.net进行开发)

Is there some way it can be removed while sending from the server ? how ? (I am using IIS and asp.net for development)

推荐答案

有一些http模块可以让所有人准备就绪你问的是什么

There are some http modules that make all ready what you ask

例如这里有一个

http://madskristensen.net/post/A-whitespace-removal-HTTP-module-for-ASPNET-20.aspx

在我看来,在某些情况下中,您不需要这么做,因为您花了更多时间在服务器上清除页面,而不是发送它,特别是如果它是gzip。一个好的解决方案是手动缓存最终的清除页面,然后发送缓存(在需要时更新它等),但这是更多的代码。

How ever in some cases in my opinion is that you do not need to do that because you spend more time on server clearing the page, than send it, especial if it is gZipped. One good solution is to manual cache the final clear page, and then send the cached (update it when its needed etc), but this is a lot more code.

类似问题

asp.net MVC ActionFilter用于删除结果中的空行

asp.net MVC ActionFilter用于删除结果中的空行

修改ASP.NET应用程序的Html输出

在谷歌搜索的关键是缩小HTML

这篇关于如何从服务器响应中删除空格和换行符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆