Automatically Compact HTML on render

U

Untitled

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
 
U

Untitled

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?
 
K

Karl Seguin

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!)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top