Common Sense ASP.NET Tips

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 article 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:

  1. 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.
  2. Use Stored Procedure – Need I explain why? This is a no brainer!
  3. Use HttpServerUtility.Transfer() – This is better than the Request() as there is no client round trip.
  4. Don’t overdo a good thing – I like this one.
    1. 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 my article 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.
  5. 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.
  6. JIT you apps – This one again is a no brainer. This is easier to do in Whidbey btw.
  7. 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.

Published by

Amit Bahree

This blog is my personal blog and while it does reflect my experiences in my professional life, this is just my thoughts. Most of the entries are technical though sometimes they can vary from the wacky to even political – however that is quite rare. Quite often, I have been asked what’s up with the “gibberish” and the funny title of the blog? Some people even going the extra step to say that, this is a virus that infected their system (ahem) well. [:D] It actually is quite simple, and if you have still not figured out then check out this link – whats in a name?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.