开发者

remove carriage return and line feed after publishing aspx pages?

开发者 https://www.devze.com 2023-03-05 11:16 出处:网络
Would it be possible to set something in asp.net applicatio开发者_开发技巧n in such a way that all of carriage return and line feed will be removed in aspx pages?

Would it be possible to set something in asp.net applicatio开发者_开发技巧n in such a way that all of carriage return and line feed will be removed in aspx pages?

For example:

if I view source of my page, I see:

<div>
   abc
</div>

I want to have:

<div>abc</div>

Thanks in advance!


You have three options depending on why you are doing this.

The first is to run a minifier during the build process; however, this is not recommended for a number of reasons. Key being that those carriage returns might be important to you.

The second is to create an httpmodule that removes them as the html is emitted back to the browser. Again, not recommended for the same reasons as above.

The third option is to simply turn on compression (gzip) for your content. This will compress it down for transfer. When the browser uncompresses it for display the carriage returns will still be there but the compression should have reduced the amount of network traffic involved.

Honestly, I can't think of a reason to do anything other than turn on regular compression. The downsides are too big.

0

精彩评论

暂无评论...
验证码 换一张
取 消