Monday, January 17, 2005

Waste of a few days

I thought I'd post this in case it can help some poor soul out there who could potentially spend days debugging the same ASP.net problem I had...

Symptoms:

  • Page loads up fine
  • Page mysteriously produces a HTTP 500 Error when a control is clicked on the page.
  • Page has always worked before now
  • Page has a datagrid populated from a database
  • No events fire on the page (or within a control on the page)
  • HTTP POST status returns ERROR_INTERNET_CONNECTION_RESET when
  • The post stream seems to be truncated
  • Code has not changed (file has been in sourcesafe for 6 months!)

Diagnosis:

This problem is caused by the viewstate of the page (which is stored in the page) getting too big. Most HTTP proxy servers have a limit of how much data they can send back to the server in one go. Due to the ever increasing level of data in the database, the datagrid gets bigger. Because the datagrid is stored (along with all the other viewstate enabled controls in the page) in viewstate, this hidden field has also got bigger. If you sniff the http post stream, you see that the output is truncated partway through the viewstate. The server receives a truncated post stream, and in this case sends back an unhelpful message.

Solution:

Delete all your data to reduce the size of the datagrid.

However if your data is important to you or someone who pays you, the best trick is to store the viewstate on the server instead of in the page. The session variable is the best bet of course. Add these two methods to the page giving you troubles (not in any web user control(s) you may be using)

Protected Overrides Function LoadPageStateFromPersistenceMedium() As Object

Return Session("_ViewState")

End Function


Protected Overrides Sub SavePageStateToPersistenceMedium(ByVal viewState As Object)

Session("_ViewState") = viewState

End Sub

Remeber that this is a workaround that will allow the page to function. Unless you are storing session state in sql server you shouldn't use this method for all of your pages to make them smaller. The session variable is stored in server memory and this will degrade performance by filling up RAM and could result in increased hard disk writing when the server has to write to a page file to store the session state. So use carefully, especially with high volume pages...


84 Comments:

Anonymous Anonymous said...

Hi, I was out blogging and found your site. It certainly got my attention and interest. I was looking for Meat information and even though this isn't a perfect match I enjoyed your site. Thanks for the read!

22 May 2006 2:24 pm

 
Anonymous <a href="http://www.xanga.com/buy_levitra">Buy Levitra</a> said...

Great article! Thanks.

18 August 2007 10:36 pm

 
Anonymous <a href="http://phentermine1.eamped.com">Phentermine</a> said...

Thanks for interesting article.

19 August 2007 4:19 am

 
Anonymous <a href="http://search.cnn.com/search?query=site:m1.aol.com/phentermine4">Anonimous</a> said...

Nice! Nice site! Good resources here. I will bookmark!

10 September 2007 6:46 am

 
Anonymous <a href="http://m2.aol.com/LorenLynn03/index8.html">Maxwells</a> said...

I see first time your site guys. I like you :)

10 September 2007 4:36 pm

 
Anonymous <a href="http://courses.cvcc.vccs.edu/ENG112_GROSS/_Chat_Room/000008fd.htm">Anonimous</a> said...

Excellent website. Good work. Very useful. I will bookmark!

10 September 2007 6:18 pm

 
Anonymous <a href="http://paydayadvisors.org">PaydayLoans</a> said...

DhWSSg You have a talant! Write more!

31 October 2007 3:20 am

 
Anonymous <a href="http://hydrocodone.99k.org/index.php">Hydrocodone</a> said...

1Ri9Qn The best blog you have!

2 November 2007 4:35 pm

 
Anonymous <a href="http://users2.titanichost.com/buyviagra/475.html">cheap insurance for new drivers</a> said...

weZ8BA actually, that's brilliant. Thank you. I'm going to pass that on to a couple of people.

3 November 2007 4:37 am

 
Anonymous <a href="http://free.7host07.com/nmcfgy/194.html">allman brothers tour schedule 2007</a> said...

Nice Article.

3 November 2007 5:27 am

 
Anonymous <a href="http://fioricet.clanteam.com/?pharma=32">brand name fioricet onlin</a> said...

Please write anything else!

3 November 2007 6:09 am

 
Anonymous <a href="http://celebrex.zxq.net/?pharma=1077">celebrex online pharmacy online</a> said...

actually, that's brilliant. Thank you. I'm going to pass that on to a couple of people.

3 November 2007 7:15 am

 
Anonymous <a href="http://m1.aol.com/BrettHead14/15.html">court cases in pharmacy technician</a> said...

Good job!

3 November 2007 8:16 am

 
Anonymous <a href="http://users2.titanichost.com/buyviagra/index11.html">xenical hgh phentermine qu it smoking d</a> said...

Good job!

3 November 2007 9:48 pm

 
Anonymous <a href="http://xenical.newsit.es/xenical-released-by-fda.html">xenical released by fda</a> said...

Good job!

4 November 2007 2:26 am

 
Anonymous <a href="http://xanax.newsit.es/dose-during-first-low-trimester-xanax.html">dose during first low tr</a> said...

Please write anything else!

4 November 2007 3:28 am

 
Anonymous <a href="http://tramadol.newsit.es/mobile-office-tramadol.html">mobile office tramadol</a> said...

Magnific!

4 November 2007 4:27 am

 
Anonymous <a href="users2.titanichost.com/amalopra">JohnBraun</a> said...

gzNHnw write more, thanks.

4 November 2007 9:38 pm

 
Anonymous <a href="http://users2.titanichost.com/popebatret/index31.html">cool sex images</a> said...

Magnific!

5 November 2007 2:46 pm

 
Anonymous <a href="http://users2.titanichost.com/inoryum/index31.html">doll make sex</a> said...

Nice Article.

5 November 2007 3:20 pm

 
Anonymous <a href="http://users2.titanichost.com/hviler/index4.html">animal toons sex</a> said...

Thanks to author.

5 November 2007 5:11 pm

 
Anonymous <a href="http://users2.titanichost.com/ansfur/index18.html">latina having sex</a> said...

Hello all!

5 November 2007 5:44 pm

 
Anonymous <a href="http://users2.titanichost.com/olds77/index23.html">latina anal</a> said...

actually, that's brilliant. Thank you. I'm going to pass that on to a couple of people.

5 November 2007 6:20 pm

 
Anonymous <a href="http://users2.titanichost.com/shingro/index1.html">set of sex</a> said...

Wonderful blog.

5 November 2007 6:49 pm

 
Anonymous <a href="http://users2.titanichost.com/scersi/index15.html">elf joy sex</a> said...

Good job!

5 November 2007 7:19 pm

 
Anonymous <a href="http://users2.titanichost.com/t1fielde/index6.html">pamanderson sex tape</a> said...

Hello all!

5 November 2007 7:50 pm

 
Anonymous <a href="http://users2.titanichost.com/adjutes/index8.html">bareback sex clips</a> said...

Thanks to author.

5 November 2007 8:24 pm

 
Anonymous <a href="http://users2.titanichost.com/adjutes/index31.html">bard yard sex</a> said...

Thanks to author.

5 November 2007 9:06 pm

 
Anonymous <a href="http://users2.titanichost.com/shiconta/index5.html">crosby park sex</a> said...

Magnific!

5 November 2007 9:46 pm

 
Anonymous <a href="http://users2.titanichost.com/gnites3/index3.html">hot sex threesomes</a> said...

Hello all!

5 November 2007 10:19 pm

 
Anonymous <a href="http://users2.titanichost.com/marymeno/index19.html">public dog sex</a> said...

Thanks to author.

5 November 2007 10:50 pm

 
Anonymous <a href="http://users2.titanichost.com/vadhoms/index17.html">maliha sex tapes</a> said...

Change is inevitable, except from a vending machine.

5 November 2007 11:25 pm

 
Anonymous <a href="http://users2.titanichost.com/etooking/index1.html">non boner sex</a> said...

Thanks to author.

6 November 2007 12:03 am

 
Anonymous <a href="http://users2.titanichost.com/swiseny/index13.html">discipline humiliation sex</a> said...

Energizer Bunny Arrested! Charged with battery.

6 November 2007 12:34 am

 
Anonymous <a href="http://users2.titanichost.com/pyzoid/index15.html">bride sex porn</a> said...

Lottery: A tax on people who are bad at math.

6 November 2007 1:32 am

 
Anonymous <a href="http://users2.titanichost.com/pyzoid/index16.html">bondage sex dvd</a> said...

Thanks to author.

6 November 2007 2:10 am

 
Anonymous <a href="http://users2.titanichost.com/selli83/index7.html">adult sex style</a> said...

640K ought to be enough for anybody. - Bill Gates 81

6 November 2007 2:40 am

 
Anonymous <a href="http://users2.titanichost.com/numdaso/index22.html">japanese sex vids</a> said...

Wonderful blog.

6 November 2007 3:12 am

 
Anonymous <a href="http://users2.TitanicHost.com/senatra/hydrochlorothiazide-magnesium.html">hydrochlorothiazi</a> said...

I'm not a complete idiot, some parts are missing!

6 November 2007 3:43 am

 
Anonymous <a href="http://cialis.whdot.com/index18.html">cialis generic ultram pills</a> said...

All generalizations are false, including this one.

6 November 2007 4:16 am

 
Anonymous <a href="http://web.archive.org/web/20070818073944/xanga.com/buyultramonline">cheap ultram</a> said...

Suicidal twin kills sister by mistake!

6 November 2007 4:49 am

 
Anonymous <a href="http://users2.titanichost.com/numdaso/index3.html">japanse sex thumbs</a> said...

The gene pool could use a little chlorine.

6 November 2007 5:28 am

 
Anonymous <a href="http://users2.titanichost.com/febisko/index13.html">bestiality sex games</a> said...

Thanks to author.

6 November 2007 6:10 am

 
Anonymous <a href="http://users2.titanichost.com/topletrufus/index13.html">girl sex homemade</a> said...

If ignorance is bliss, you must be orgasmic.

6 November 2007 6:48 am

 
Anonymous <a href="http://users2.titanichost.com/yetzeit/index12.html">arizona sex offenders</a> said...

I don't suffer from insanity. I enjoy every minute of it.

6 November 2007 7:20 am

 
Anonymous <a href="http://users2.titanichost.com/brittanyrogers/41-0411.html">all ebony sex</a> said...

When there's a will, I want to be in it.

6 November 2007 7:53 am

 
Anonymous <a href="http://users2.titanichost.com/glicia80/index13.html">sex augusta ga</a> said...

Nice Article.

6 November 2007 8:23 am

 
Anonymous <a href="http://users2.titanichost.com/reekello/index29.html">daily sex pics</a> said...

C++ should have been called B

6 November 2007 8:48 am

 
Anonymous <a href="http://users2.titanichost.com/tortene/index2.html">oergon sex offender</a> said...

Friends help you move. Real friends help you move bodies.

6 November 2007 9:17 am

 
Anonymous <a href="http://users2.TitanicHost.com/kopelar/clonazepam-pms.html">clonazepam pms</a> said...

Friends help you move. Real friends help you move bodies.

6 November 2007 9:48 am

 
Anonymous name said...

What is a free gift ? Aren't all gifts free?

6 November 2007 10:18 am

 
Anonymous <a href="http://users2.titanichost.com/cuhozhilov/index1.html">dragonball z porn videos</a> said...

Magnific!

6 November 2007 10:55 am

 
Anonymous <a href="http://users2.titanichost.com/robertf/index11.html">psp xxx porn</a> said...

actually, that's brilliant. Thank you. I'm going to pass that on to a couple of people.

6 November 2007 11:27 am

 
Anonymous <a href="http://users2.titanichost.com/maxeevich/index12.html">animated cartoon porn</a> said...

The gene pool could use a little chlorine.

6 November 2007 12:05 pm

 
Anonymous <a href="http://users2.titanichost.com/dityroe/index15.html">lezo sex pics</a> said...

Thanks to author.

6 November 2007 12:36 pm

 
Anonymous <a href="http://users2.titanichost.com/liperwo/index2.html">attack sex clips</a> said...

Build a watch in 179 easy steps - by C. Forsberg.

6 November 2007 1:07 pm

 
Anonymous <a href="http://users2.titanichost.com/dasistorama/index13.html">free viedio porn</a> said...

Magnific!

6 November 2007 1:39 pm

 
Anonymous <a href="http://users2.titanichost.com/rego07/index15.html">cnn com net porn controls useless study</a> said...

Oops. My brain just hit a bad sector.

6 November 2007 2:18 pm

 
Anonymous <a href="http://users2.titanichost.com/artinko/index34.html">grayvee com free porn amateur couple fu</a> said...

640K ought to be enough for anybody. - Bill Gates 81

6 November 2007 3:03 pm

 
Anonymous <a href="http://users2.titanichost.com/lindafmosley/index24.html">dogs impacted anal glands</a> said...

Build a watch in 179 easy steps - by C. Forsberg.

6 November 2007 3:37 pm

 
Anonymous <a href="http://users2.titanichost.com/tereritoa1/index33.html">fres sex stories</a> said...

Wonderful blog.

6 November 2007 4:16 pm

 
Anonymous <a href="http://users2.titanichost.com/eynol/index18.html">porn star nicknames cums alot</a> said...

All generalizations are false, including this one.

6 November 2007 4:53 pm

 
Anonymous <a href="http://users2.titanichost.com/dentouj/index32.html">hentai sex xxx</a> said...

Oops. My brain just hit a bad sector.

6 November 2007 5:24 pm

 
Anonymous <a href="http://users2.TitanicHost.com/turtra/ibuprofen-interaction-with-aspirin.html">ibuprofen int</a> said...

Friends help you move. Real friends help you move bodies

6 November 2007 6:03 pm

 
Anonymous <a href="http://users2.titanichost.com/bybonte/index4.html">chastity video sex</a> said...

Friends help you move. Real friends help you move bodies

6 November 2007 6:45 pm

 
Anonymous <a href="http://users2.titanichost.com/unareq/index22.html">pilipino sex clips</a> said...

Nice Article.

6 November 2007 7:29 pm

 
Anonymous <a href="http://users2.titanichost.com/mezers/index24.html">busty movie sex</a> said...

Energizer Bunny Arrested! Charged with battery.

6 November 2007 8:17 pm

 
Anonymous <a href="http://users2.titanichost.com/deswef/index32.html">cartoon fun sex</a> said...

Ever notice how fast Windows runs? Neither did I.

6 November 2007 9:01 pm

 
Anonymous <a href="http://users2.titanichost.com/tedethe/index34.html">free backroom sex</a> said...

Calvin, we will not have an anatomically correct snowman!

6 November 2007 9:41 pm

 
Anonymous <a href="http://users2.titanichost.com/simpleplayer/index20.html">how to find reliable free porn</a> said...

If ignorance is bliss, you must be orgasmic.

6 November 2007 10:28 pm

 
Anonymous <a href="http://users2.titanichost.com/sobermi/index13.html">internet sex dolls</a> said...

actually, that's brilliant. Thank you. I'm going to pass that on to a couple of people.

6 November 2007 11:22 pm

 
Anonymous <a href="http://users2.titanichost.com/clydej/index8.html">wrestling porn</a> said...

Please write anything else!

7 November 2007 12:11 am

 
Anonymous <a href="http://users2.titanichost.com/xcalomi/index33.html">jock sex porn</a> said...

If ignorance is bliss, you must be orgasmic.

7 November 2007 12:54 am

 
Anonymous <a href="http://users2.titanichost.com/ramisew/index.html">pokemon sex flash</a> said...

Magnific!

7 November 2007 1:34 am

 
Anonymous <a href="http://users2.titanichost.com/hegory/index21.html">bbw porn free</a> said...

Energizer Bunny Arrested! Charged with battery.

7 November 2007 2:13 am

 
Anonymous <a href="http://users2.titanichost.com/sidspros/index26.html">korean hotties sex</a> said...

C++ should have been called B

7 November 2007 2:49 am

 
Anonymous <a href="http://users2.titanichost.com/whitedenster/index30.html">cheerleader porn</a> said...

640K ought to be enough for anybody. - Bill Gates 81

7 November 2007 3:24 am

 
Anonymous <a href="http://users2.titanichost.com/MarcellaDurant/index12.html">masturbation guide anal play</a> said...

Lottery: A tax on people who are bad at math.

7 November 2007 4:08 am

 
Anonymous <a href="http://users2.titanichost.com/cationie1/index9.html">parker posey sex</a> said...

Save the whales, collect the whole set

7 November 2007 4:50 am

 
Anonymous <a href="http://phentermine.43i.net/index7.html">buy inurl phentermine</a> said...

A flashlight is a case for holding dead batteries.

7 November 2007 5:33 am

 
Anonymous <a href="http://phentermine.43i.net/300-061107.html">buy phentermine with mastercard best online pha</a> said...

What is a free gift ? Aren't all gifts free?

7 November 2007 6:22 am

 
Anonymous <a href="http://phentermine.43i.org/106-061107.html">buy cod online soma cheap phentermine online bu</a> said...

Beam me aboard, Scotty..... Sure. Will a 2x10 do?

7 November 2007 7:11 am

 
Anonymous <a href="http://users2.titanichost.com/nimytre/index17.html">idaho sex offender</a> said...

Magnific!

7 November 2007 7:48 am

 
Anonymous Anonymous said...

Many individuals are concerned about becoming a victim of payday loan swindles [url=http://www.pihquickloans.co.uk/]quick loans uk[/url] quick loans You can improve the process if you know the dealer expenses or Blue Book price of the car; the top consumer location to find out real dealer value or that of a pre-owned car will probably be worth is by far Edmunds http://www.gtwtq.co.uk/

20 April 2013 8:04 pm

 

Post a Comment

<< Home