Those who are unfortunate enough to know me, know I keep saying Common Sense is not very Common (and how true it is). VS Mag has an <strong>article</strong> that list out some best practises for ASP.NET though they do it from a performance perspective, I feel everyone should do these irrespective what their perf. requirements are:
Use Page.IsPostback - There is a lot of stuff one does when the page loads the first-time, no need to keep doing it again and again.
Use Stored Procedure - Need I explain why? This is a no brainer!
Use HttpServerUtility.Transfer() - This is better than the Request() as there is no client round trip.
Don’t overdo a good thing - I like this one.
- Save ViewState only when necessary - now why din’t I think of this before? *grin*.
- Don’t Rely on Exceptions - They are expensive! Make sure it is an exception and not you being lazy. You can read <strong>my</strong> <strong>article</strong> on it if you wish.
- Restrict use of Session state - Switch it off when not using it - this is on by default and as all good things go its not free.
Limit server controls - Server controls also have a pretty decent overhead as they require server-side support and are quite chatty between your client and the server. You should use a HTML control wherever possible.
JIT you apps - This one again is a no brainer. This is easier to do in Whidbey btw.
Use Caching - Either use your own or ASP.NET’s caching, but remember not to put items that expire very quickly in the cache - there is a fine line and you might want to do some stress and load testing to see what balance works for you.