About the author

Miron Abramson
Me
Software Engineer,
CTO at PixeliT
and .NET addicted for long time.
Open source projects:
MbCompression - Compression library

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2014

Creative Commons License

Blog Flux Directory
Technology Blogs - Blog Top Sites

Optimize your page for UpdatePanel

One of the most (or the most) common use MS-AJAX control is the UpdatePanel.  It let us send data to the server and get response asyc, and change part of the page without refreshing the page, and it give us faster and more nice user interaction. Altho it sound perfect, it have big limitation.  While compressing the page, remove white spaces in the HTML and make our page very light, it is impossible  to modify the response for the update panel. In every method (in the Render event or any Handler/Module) that we made that modify the response, we must exclude the respose that made by the UpdatePanel.  The result is that we have a page with UpdatePanel that refreh a part of the page, we compressed the page and made it very light (lets say we compressed it from 30Kb to 5Kb). When we click the button that activate the update panel, it send the update panel request and receive its response, but this response is not compressed and can be sometimes even bigger than the complete page (that was compressed). It's a big contradiction!

There is a small thing we can do, it's really small, but better than nothing. The response for the UpdatePanel is build base on the original ASPX (before any compression), so, what we can do is, to optimize our original ASPX by removing any whitespaces. That will make the UpdatePanel response a little smaller.

What I use to do, is publish the site, and before uploading the files to the server, I optimize the ASPX files that have any UpdatePanel.

It is realy not big, but it is something.

In the bottom, you can download a tool I made to remove the white spaces from the ASPX and optimize it. Just copy your ASPX code and click optimize, and save that optimized code. 

OptimizeASPX.exe (20.00 kb)

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: ASP.NET | C# | Server side
Posted by Miron on Sunday, November 18, 2007 2:27 PM
Permalink | Comments (9) | Post RSSRSS comment feed

Related posts

Comments

DotNetKicks.com

Sunday, November 18, 2007 2:52 PM

trackback

Trackback from DotNetKicks.com

Optimize your pages for UpdatePanel

steve raynold

Sunday, November 18, 2007 9:32 PM

steve raynold

what are you talking about?

ah the senses once again left you or what? your aspx files aren't returned back...just generated html. It doesn't matter how much white spaces, comments or something elese you have in your aspx code...omg

Miron us

Monday, November 19, 2007 1:13 PM

Miron

Steve, of cource your aspx files aren't return back, only generated HTML, but this HTML base on your ASPX.
Try it, and you will. The response for the update panel include all generated HTML between your opening UP control tag and the closing tag, include all the comments and white spaces you put there in your ASPX code!

steve.raynold

Tuesday, November 20, 2007 8:20 PM

steve.raynold

wow, that sux Wink

tried it actually, that is a BIG NEWS! I haven't been using update panel from MS (using a special something-like-that commercial version of it) but that really *** Wink

ok my appologies to you, just one question you won't know an answer. What the MS guys are thinking they are doing of releasing such a code? Hope update panel has been "updated", I can't understand why anyone would like to have comments generated and returned Wink

Going to try it in .NET 3.5...download of vs2008 should be finished.

steve.raynold

Tuesday, November 20, 2007 8:33 PM

steve.raynold

I should have realize that. To say it more clearly for ppl to realize what your article is about (hope I'm not the only one that misunderstood itWink I paste a "comment" from one codeproject.com project Wink

<i>
However, one drawback of the UpdatePanel is that when it refreshes its content, it instantiates not only the UpdatePanel but also the entire page. It's great in some cases when you have several parts of the page interacting. However when your UpdatePanel is independent (a menu for example) from the main content and your page is heavy, the side effect is that it takes ages to refresh only a small part of your page. </i>

But I have never realized that comments are being returned. White spaces are compressed byt IIS compression, I think it won't matter, will it? You can add more research to it, would be nice...

Miron us

Tuesday, November 20, 2007 11:28 PM

Miron

If you are on share hosting, than you don't have control on the IIS compression, the only way to compress your page is programaticaly. As you can read in my post, you can not compress any Update Panel response (it will break the response special format), and that what I meant in my post. One way to improve those response is to use the attached tool to remove white spaces

Impi za

Monday, February 16, 2009 6:12 PM

Impi

Would it be possible to get the code for the optimizer so one can expand it to open a whole folder stucture
and do the whitespace removal for all the asp pages in the folder.

Miron il

Wednesday, February 18, 2009 9:47 PM

Miron

@Impi,
I don't think I have the source anymore, but you can easily get the code using Reflector (http://www.red-gate.com/products/reflector/)

Foreclosure Help us

Monday, March 16, 2009 12:05 AM

Foreclosure Help

Awesome site. Very informative and nice design. I really like your posts and your style.