Ad

How To Reduce Size Of Html Rendered From ASP.net?

- 1 answer

I'm developing a newsletter in asp.net that will be send to a large quantity of users, so each kilobyte that I can reduce will help a lot in the use of bandwidth consumption, what I do until know is write the aspx excluding some spaces between tags, and before render, i've renamed some controls ids to "-" to save more space. So now, the file has 50kb. I need a file with 25 Kb.

Can anyone teach me any other way do save more space ?

ps.: I Use 3 divs with some data, and 2 repeaters, one inside other, to generate a table with some data for me.

EDIT: I've disabled viewstate, and remove unnecessary divs, I'll try to verify if gzip is enabled in IIS.

thanks in advance

Ad

Answer

Make sure HTTP compression is enabled. It will help to reduce the amount of HTML, but enabling HTTP compression will give more than the marginal improvements you're likely to see.

There are different ways to enable compression, depending on your version of IIS. For instance, in IIS 6.0, you can manually edit metabase.xml or run:

cscript adsutil.vbs set w3svc/filters/compression/parameters/HcDoDynamicCompression true 

You can check HTTP headers to verify that compression is enabled using something like https://addons.mozilla.org/en-US/firefox/addon/3829/ Live HTTP Headers for Firefox. Check your headers for "Content-Encoding: gzip".

Ad
source: stackoverflow.com
Ad