Wednesday, January 30, 2008

Optimizing ASP.NET and HTML pages

A comprehensive checklist will serve you well:

- Turn ViewState off on page and control levels when not needed

- Turn SessionState off:
"Session objects consume valuable resources. By turning off sessions, you can improve the performance and scalability of your ASP Web application. You can turn off session state either for the whole Web site or for specific ASP pages."
http://support.microsoft.com/kb/244465

- Alternatives to server controls include simple rendering, HTML elements, inline Response.Write calls, and raw inline angle brackets (<% %>).
(http://msdn2.microsoft.com/en-us/library/ms998549.aspx)

- Especially if not compressing html:
Remove or reduce white space. Removing white spaces can dramatically reduce the size of your pages. Less white space did have about a 5-10K impact on move.com home page when viewed on the browser File-Properties.

-Avoid long control names; especially ones that are repeated in a DataGrid or Repeater control. Control names are used to generate unique HTML ID names. A 10-character control name can easily turn into 30 to 40 characters when it is used inside nested controls that are repeated.

- Use Output caching for user controls , pages, etc. (%@OutputCache directive
)

- Use static properties instead of the Application object to store application state.
(http://msdn2.microsoft.com/en-us/library/ms998549.aspx)


- Use client side validation to avoid unnecessary server hits

-Avoid Creating Deep Hierarchies of Controls (see http://msdn2.microsoft.com/en-us/library/ms998549.aspx#scalenetchapt06_topic11)


Checklist: ASP.NET Performance:
http://msdn2.microsoft.com/en-us/library/ms998596.aspx

Thursday, January 3, 2008

flushing DNS in Windows and MAC OS

Windows:

ipconfig /flushdns


MAC (before Leopard):
sudo lookupd -flushcache

MAC - Leopard:
dscacheutil -flushcache