ASP.net Performance Tips – A Follow Up

ASP.net Performance Tips

Great Response from Readers!

Hats off to all the great responses and discussion to this post on asp.net performance enhancements!  I wanted to take some time to clarify some comments to ensure you that I am indeed not crazy ;)   The unfortunate side of Blogging is that you can’t go into too much detail in certain cases, otherwise every post would take days to write and explain every angle, and cause reader’s (like you right now going, “get to the point!”) to fall asleep and tune out. 

Hence we will be launching a Wiki in the next few days to go into more detail on topics, and leverage our awesome reader’s knowledge!  We also have the forums up and running right now, so feel free to take your discussions there!

If you haven’t read the original article, make sure you check it out, 20 Tips to Improve ASP.net Application Performance!

Tip Number 3: Avoid Server-Side Validation

By no means am suggesting we turn off server-side validation.  Some users have JavaScript turned off, and will not be able to use your site correctly if you rely heavily on JavaScript.  Without Server-Side Validation, bad data can get to the server!  A great approach to take here is use both.  By using both, you ensure that only correct data flows into your database! 

There are also certain situations where your validation requires database reads to find out if data is valid.  Here of course is another ideal use of Server-Side Validation.  Another side note by the way is if your database is structured correctly, it should hopefully not allow bad data to be entered into it.

The main point I was trying to make is educate a few people that purely use Server-Side Validation!  Put some resources on the client, and everyone will jump for joy!  If you have an application that relies on Server-Side Validation, and you add Client-Side, you will notice a dramatic speed improvement!  I hope this clears it up!

Tip Number 6: Server.Transfer vs. Server.Redirect

The reality here is the article was based on “Performance”.  However to dive into more details, there are actually three distinct methods of transferring data in ASP.net.  Response.Redirect, Response.Transfer, and the new Cross-Page Posting available in ASP.net 2.0 and greater. All of these methods have positives and negatives.  Just like most things in life, you will need to decide the best approach for your given application.  Let’s take a look quickly at some of these pro’s and con’s

Response.Redirect

Without getting into to much detail, this approach is heavy and “slower” because it requires a roundtrip to the server instead of just telling the user, “Go here”.  It also has restrictions on the length of your query string, and gives a lot of “visibility” to the user either in the URL

It is the simplest approach however, with the least ”hack” around needed (think back button issue that Mike Pope talked about, Thanks Mike!).

Response.Transfer

Some of you might not know this if have not completely read up on ASP.net 2.0, there are definitely some awesome improvements in 2.0!  Using the new PreviousPage.FindControl, you can actually sift through the data being received.  Works very well!  There are some “tricks” to this approach, but I will go into it in later articles, and possibly on the Wiki.

So Response.Transfer is no question faster!  It does not include the roundtrip, however, the browser thinks it is still on the same page or form, therefore, your back button wrecks havoc on this implementation, however it can be handled if your are careful/skilful.  So this approach is faster, but has some issues that you should be aware of!

Cross-Page PostBacks

A new feature in ASP.net 2.0 is Cross-Page PostBacks that work really nice with forms.  Just setting the button’s PostBackUrl property to the new page makes the magic happen.  It’s very easy to check to see if there was data sent by checking the PreviousPage.IsCrossPagePostBack

So what do you suggest?

Use what you are most comfortable with, and what best suits your environment.  However just remember that:

  1. Response.Redirect is slower and will show QueryString data in the URL.
  2. Response.Transfer is fast, however creates an “invalid” browser history.
  3. Cross-Page Postbacks work well, however do not work well with Server-Side only validation.

Anything else to mention on this topic?  Oh yes, SEO optimization.  I would use neither of these methods if I’m moving pages, servers, etc.  For those cases, use a 301!  What is a 301?  It’s basically a way to tell search engines and other browsers that a resource has moved and the links should be updated.  Using this method, you will not lose the Google Juice (mostly), and can expect search engines to update their databases in a few days!

I love how the quiet ASP.net developers pitched in and brought their valued feedback, opinions, and criticisms!  That’s what the Real World is all about!  Keep it coming!

 

  • Hax Or

    The fact that so many people ‘misunderstood’ your #3 from your original post is embarrassing. Sorry they filled your comments up with their ignorance. It was 100% clear from your article that you recommend “Adding Client-Side”… that means the client does it’s job FASTER and FIRST.

    The fact that so many people jumped on this – in their limited capacity to grasp the issue – is one of my pet peeves. I don’t think they are ignorant … I think they are ‘jerks’. LOL

  • http://www.uggbootshouse.com uggs outlet

    Yayayaya! I understand your feelings…

  • james

    Tip no.7:

    Use distributed cache for data intensive applications. Avoid ASP.NET cache, which is single point of failure, has data integrity problem in web farm/garden and is not scalable.
    Use third-party distributed cache like Ncache express to get scalable performance of your ASP.NET application even at peak load times.

  • steve

    ASP.NET cache has several problems as highlighted above and here:
    http://distributedcache.blogspot.com/2010/05/aspn…
    http://distributedcache.blogspot.com/2010/05/aspn…

    So, it is not recommended for data-intensive and mission-critical applications.

  • http://www.christianlouboutindior.com christian louboutin

    good post,i like it

  • http://www.solowatches.com/ solo

    This is all so interesting! We've certainly come a long way since the birth of the computer and the Internet!

  • gryte

    Yiwu agent,Yiwu export agent in Yiwu Market – the biggest wholesale market of commodity yiwu in China,with more than 40000 wholesalers & factories yiwu china,thousands of foreign buyers …

    yiwu agent-We provide agent service such as yiwu export agent yiwu china yiwu shipping agent, yiwu trade agent, yiwu purchasing agent, yiwu buying agent, yiwu agent, agent in yiw Our professional servicers yiwu wholesale can give you the best service!

  • http://www.givenchyoutlet.com/ givenchy

    Thank givenchy you very much for your post, it is indeed wonderful to read your article,I like it very much.

  • macrowski
  • http://www.nikeairmax.me/air-max-2011-new-c-66.html air max 2011

    I always see your blog.
    I am looking forward to renewal of your blog.
    Please take a look my site, if it’s possible.

  • http://www.gfgkfgjf.com zeng
  • zara
  • http://www.replica-louisvuittons.com/ handbags

    louis vuitton replica Handbags,Very good post. Made me realize I was totally wrong about this issue. I figure that one learns something new everyday. Mrs Right learned her lesson! Nice, informative website by the way.

  • http://www.who1esale-blog.org/ Moncler

    Hello there! I completely agree with your opinion. I really respect what you’re doing here. Moncler

  • http://www.baleshop.co.uk karen millen

    I’d really like to say, wonderful Discount karen millen . I am unclear if perhaps remember that it is attended to, however when applying Ie I can by no means receive the overall web site in order to heap devoid of refreshing a lot of occasions. Could just be my own Karen millen dresses.

  • http://www.kongbags.com handbags

    I like your post wholesale replica handbags,
    replica bags, very much, thanks for your work.

  • http://www.handbagsbylouisvuitton.com/men-1.html LV mens bags

    louis vuitton replica handbags,Thanks for sharing your article. I really enjoyed it. I put a link to my site to here so other people can read it. My readers have about the same interets

  • http://www.coachsoutlet-us.com coachbags

    Coach continues to innovate each season, turning out new colors, styles and designs. Every winter, coach wristlet top many women's Christmas wish lists.The full history of the coach diaper bags gives fashion lovers an appreciation for more than the company's quality and craftsmanship.It illustrates how this company has survived in the fickle fashion world through innovation, marketing and design.

  • doudou1232

    v

  • coachoutletpurses

    This season they made a smart move and headed to coach outlet online for some serious Canadian seam taping., but a more adventurous outing would serve the brand well in its bid to move beyond polo coach purses in the consciousness of fashion coach factory outlet online customers. The original 16 leaf coach luggage bag has been removed and replaced with a 30 leaf coach luggage bags, giving the coach factory outlet a clear identity and personality:Built around coach factory outlet canvas, a highly breathable, extremely water resistant and completely windproof fabric made from densely woven, Egyptian canvas that swells up and seals when exposed to water.

  • yabin

    Chanel outlet is dedicated to provide you the Chanel online, Chanel online store, Chanel Bags online all over the world with EMS, free shipping. To secure your order we adopt online credit card payment and for each items sold, 14 days money back guarantee is made.

  • http://www.monclerpiuminiitaly.com moncler piumini

    Italian Moncler Nantes Hooded Coat Black down clothing expert Moncler,Moncler Jura Down Coat this section of childhood when is called as the outer space to be ragged, also or is called Michelin's best protection against the cold Moncler Lucie Down Coat excellent works belt to return to the tidal current. Eliminates the Moncler itself salt fish to turn lives, many fashionable brands also make use are divided cup of thick soup, promotes Moncler Messina Coats the fashionable taste full modern down clothing, collects specially designs famous teacher Kris Moncler Nantes Hooded Down Coat Van Assche the product, will have a look at the moist person to be deeply in love in the Moncler this feather palace, will throw the famous teacher to embrace in addition.

  • http://www.guccihandbags-it.com Gucci Borse

    Grazie a $ 1,3 miliardi di sterline (2.055 milioni dollari) di chilometri quadrati della matrice radio (SKA), alcuni dei misteri dell'universo, finirà per trovare la Gucci Borse risposta. Si raccolgono un sacco di informazioni sull'universo, al fine di affrontare questi dati, abbiamo bisogno di una funzione equivalente a 10 milioni di personal computer super computer. Serie km di diametro radio sarà 1900 miglia (3057,75 km) di migliaia di chilometri quadrati di superficie è di 1 antenna farfalla, fornirà un sacco di dati umano sull'universo, un astronomo ha detto che cambierà completamente la Gucci Scarpe nostra visione del universo. Associazione britannica delle Scienze e Discovery Center, Ian – Dr. Griffin, ha dichiarato: "La piazza km programma radiofonico serie offrirà agli astronomi un nuovo strumento, cambiare completamente la nostra comprensione dell'universo a causa delle dimensioni enormi, il telescopio mostrerà il dettaglio incredibile galassia , mistero emozionante attraverso lo studio di Gucci 2011 oggetti come i buchi neri, la teoria di test della relatività di Einstein per contribuire a rendere la storia dell'universo primordiale, gli astronomi saperne di più. "Le istituzioni scientifiche credo anche che se il nostro sistema solare diverso l'esistenza della vita, chilometro quadrato Radio serie troveranno che offrono le migliori opportunità. Per raggiungere questo obiettivo, ma anche una tecnologia gucci uomo innovativa.

  • http://www.perfectwomenhadbags.com/yves-saint-laurent-c-72.html yves saint laurent

    store, which is selling all the branded items. You can also place an order for your most loved Chanel handbag, over internet.

  • http://www.nicemoncler.net moncler jacke

    When It Comes to Snowboard Jackets, moncler jackeIs Gore-Tex the Best Option? moncler jackeThe technology behind snowboard jackets has changed drastically in the past few years.moncler jacke It wasn’t long ago that if you wanted to stay warm up on the slopes youmoncler jacke

  • http://www.teknocrat.com/ssd-vs-hdd-analysis-and-comparison.html SSD vs HDD
  • http://www.uk-barbourjacket.com/ Barbour Ryder Jacket

    There are many brands of barbour fusilier in the market today. Each of the brand promises to bring out something new to the customers. jackets barbour is also a renowned and reputed brand in the market. This brand is in fact reputed for the Barbour jacket . You can purchase a Barbour enduro leather jacket and you would be amazed to find yourself. There are different varieties in the barbour scott bracken jacket that you would get in the market.We will try to provide you few varieties of the barbour Shoreman Jacket that are available in the market. The barbour jackets is basically a classically designed and styled Barbour combat coat.

  • http://www.louisvuittononlines.org/ LV BagsLV Bags

    and lives. For instance, if someone buys some fake medicines, it may not cure him

    of his illness, onthecontrary,<ahref="http://www.louisvuittononlines.org/"title="LV

    Bags">LV Bagsit may probably make his illness worse or even put an end to his

    life. Besides, fake commodities<a href="http://www.onlines-

    louisvuitton.org/"title="Louis Vuitton Handbags">Louis may impair the profit of

    the manufactures who<a href="http://www.onlines-louisvuitton.org/"title="Louis

    Vuitton Handbags">Louis Vuitton Handbags produce

  • Alix

    Thanks for sharing. Plasterboard-Systems

  • cheap canada goose

    Canadian goose jacket, using a excellent brand name clothes, which was founded in Canada. white canada goose jacket within of the outfits latest market in winter.These design Canada goose vest to preserve the look at of person. This canada goose coats can be turned off or draft or by a zip-front nylon zipper flap coverage.