views:

328

answers:

6

When designing a ASP.net WebForm application what are some important steps to take (or hacks if you like to use the term) to ensure the best possible performance (in terms of speed, stability, and scalability)?

+5  A: 

You've got a ton of material, directly from Microsoft here. Also a checklist is available if you want condensed information.

Andrei Rinea
+5  A: 

Here's a good Best Practices written by microsoft. Chapter 6 is specific to ASP.NET, but the whole document is .NET in general.

Ricardo Villamil
+3  A: 

There is a phenominal book on this subject by one of the Yahoo guys, Steve Souders. It taught me a lot.

Or you can just watch this video. It's a high level overview of the same information - you can pick up a lot in 45 minutes by watching this.

NOTE: This content is not WebForms-specific. It's general best practices for the web, and it is what you need if you are trying to roll out a high performance website.

Brian MacKay
+3  A: 

Big # 1 tip: turn off viewstate in the web.config. That should have been the default, if you need it for a control turn it on on a control by control basis.

My other piece of advice is stay the hell away from *view controls. Use repeaters and find a good 3rd party grid control. The really "magical" controls that ship with asp tend to be perf hogs, and in general just not a good idea anyways (with the possible exception of ListView)

Matt Briggs
+2  A: 

Just a couple, in addition to the good advice already given,

  1. Don't put every single page in a webform, not everything needs it - The default behaviour from VS is to give you a master page that wraps a form around everything, and a lot of people seem to stick with that. In my experience, some controls can render 30% faster outside of a webform, so if you're just parsing a querystring then reading something from a database, leave the form at home if you can. Even getting your navigation out of the form will help.
  2. Don't use a server control when plain old HTML will do - does it really require a asp:linkbutton or asp:hyperlink just to go to the FAQ page etc. Plain hyperlinks work just fine in asp.net, but some people seem to get stuck on the idea of using runat="server" for everything.
seanb
A: 

1 - Turn on content compression on iis

2 - Cache everything you can

This will do for the majority of webapps out there.