Compress and minify published ASP.NET pages
I made a small test and on a standard ASP.NET page, just only with removing whitespaces and line breaks, page size decreased by %35-40. Lower page size means higher performance. There are solutions for it but all are based on server side dynamic solutions. But there is a simplier way. For ex. just clean it when it is published and generate dynamic controls accordingly. It won't any give runtime overhead and will only give performance.
4 comments
-
Bertrand Le Roy commented
Almost all controls use a html text writer. It should not be too hard to pick at runtime between the regular one used today and a compressing one, based on config.
What will be more of a challenge, however, is the static strings in aspx and cshtml files. You would need a different method for those. One possibility would be to do the compression at compile-time, based on the debug/release current config. When compiling a file, the generated code could feed compressed strings to the compiler. -
Anonymous
commented
What is URL REDIRECTION?How can i use this concept in my .net?
my task is i have generated one url like this "http://example.com/"
I am passing one pearameter like "http://example.com/Empno=1"
I want to display Ename in Database table that corresponding "Empno"
plz Help me Give me one simple exampleI am new this concepts
plz Help me send source code to my mailID:mandla.anilbabu@gmail.com -
Ömer Çelik
commented
It is good, but my point is doing this on dynamic pages without any effort. So, when debugging etc. it will show full page output with indentation etc. But when it is published, it means it is ready to be deployed, clean the HTML tags and publish accordingly. So, no runtime performance decrease and we will get smaller pages.
-
Andrey Taritsyn
commented
To HTML5-documents you can apply a more powerful minification, if the use of the approaches, which are described in Karl Seguin`s article "Minimalist Markup" - http://openmymind.net/Minimalist-Markup