By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,694 Members | 2,121 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,694 IT Pros & Developers. It's quick & easy.

Automatically Compact HTML on render

P: n/a
Is there a component that i could use to automatically compact (remove
white spaces, new lines maybe, etc..) the rendered HTML pages?

When writing HTML, developers like to add spaces and newlines to make
the code more readable. When a single space is added to a datagrid
control, and this datagrid control has renders a 1000 items, this adds
1000 useless spaces to the HTML output.

Is there any way to get arround this? To have ASP .NET automatically
compact/compress the html before it is sent to the client browsers?

Thanks

Mark

Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Check out:
http://www.blowery.org/code/HttpCompressionModule.html

it isn't a compacter, it's a compressor

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Untitled" <ma*******@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Is there a component that i could use to automatically compact (remove
white spaces, new lines maybe, etc..) the rendered HTML pages?

When writing HTML, developers like to add spaces and newlines to make
the code more readable. When a single space is added to a datagrid
control, and this datagrid control has renders a 1000 items, this adds
1000 useless spaces to the HTML output.

Is there any way to get arround this? To have ASP .NET automatically
compact/compress the html before it is sent to the client browsers?

Thanks

Mark

Nov 19 '05 #2

P: n/a
I think i rather use a compactor. But that's only because i don't
really understand how a compressor would work. I mean how does the
browser know to decompress the HTML output? And if it does know to do
so, how does it know what algorithm to use?

Nov 19 '05 #3

P: n/a
Compression is supported by HTTP. When the browser sends a request, it
tells the server which type of compression is supports (gzip or deflate).
Http compression modules (like the one I provided a link to), read this and
compress the output accordingly and tell the browser how it was compressed.
The browser then compresses it. If the browser doesn't send a header with
the type of supported compression, nothing happens. In other words, it's
baked into HTTP and the browsers. The specific module is simply a .Net
implementation for use specifically in ASP.Net projects.

It's true that the content won't always be compressed (when the browser
doesn't support it), but most modern browser do support it....and compared
to a compactor, it'll make a much bigger difference in the file size.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Untitled" <ma*******@hotmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I think i rather use a compactor. But that's only because i don't
really understand how a compressor would work. I mean how does the
browser know to decompress the HTML output? And if it does know to do
so, how does it know what algorithm to use?

Nov 19 '05 #4

P: n/a
blah, I re-read that and there's a bunch of writing mistakes...but you get
the idea ;)

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:ON**************@TK2MSFTNGP14.phx.gbl...
Compression is supported by HTTP. When the browser sends a request, it
tells the server which type of compression is supports (gzip or deflate).
Http compression modules (like the one I provided a link to), read this
and compress the output accordingly and tell the browser how it was
compressed. The browser then compresses it. If the browser doesn't send a
header with the type of supported compression, nothing happens. In other
words, it's baked into HTTP and the browsers. The specific module is
simply a .Net implementation for use specifically in ASP.Net projects.

It's true that the content won't always be compressed (when the browser
doesn't support it), but most modern browser do support it....and compared
to a compactor, it'll make a much bigger difference in the file size.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Untitled" <ma*******@hotmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I think i rather use a compactor. But that's only because i don't
really understand how a compressor would work. I mean how does the
browser know to decompress the HTML output? And if it does know to do
so, how does it know what algorithm to use?


Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.