how to remove spaces and newlines from server response?

◇◆丶佛笑我妖孽 提交于 2019-12-12 01:56:40

问题


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 ?

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


回答1:


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

For example here is one
http://madskristensen.net/post/A-whitespace-removal-HTTP-module-for-ASPNET-20.aspx

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.

Also similar questions
asp.net MVC ActionFilter for remove empty lines in result

asp.net MVC ActionFilter for remove empty lines in result

Minify Html output of ASP.NET Application

And the keys to search on google is "Minify Html"



来源:https://stackoverflow.com/questions/2743594/how-to-remove-spaces-and-newlines-from-server-response

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!