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...


85 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 Buy Levitra said...

Great article! Thanks.

18 August 2007 10:36 pm

 
Anonymous Phentermine said...

Thanks for interesting article.

19 August 2007 4:19 am

 
Anonymous Anonimous said...

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

10 September 2007 6:46 am

 
Anonymous Maxwells said...

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

10 September 2007 4:36 pm

 
Anonymous Anonimous said...

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

10 September 2007 6:18 pm

 
Anonymous PaydayLoans said...

DhWSSg You have a talant! Write more!

31 October 2007 3:20 am

 
Anonymous Hydrocodone said...

1Ri9Qn The best blog you have!

2 November 2007 4:35 pm

 
Anonymous cheap insurance for new drivers 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 allman brothers tour schedule 2007 said...

Nice Article.

3 November 2007 5:27 am

 
Anonymous brand name fioricet onlin said...

Please write anything else!

3 November 2007 6:09 am

 
Anonymous celebrex online pharmacy online 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 court cases in pharmacy technician said...

Good job!

3 November 2007 8:16 am

 
Anonymous xenical hgh phentermine qu it smoking d said...

Good job!

3 November 2007 9:48 pm

 
Anonymous xenical released by fda said...

Good job!

4 November 2007 2:26 am

 
Anonymous dose during first low tr said...

Please write anything else!

4 November 2007 3:28 am

 
Anonymous mobile office tramadol said...

Magnific!

4 November 2007 4:27 am

 
Anonymous JohnBraun said...

gzNHnw write more, thanks.

4 November 2007 9:38 pm

 
Anonymous cool sex images said...

Magnific!

5 November 2007 2:46 pm

 
Anonymous doll make sex said...

Nice Article.

5 November 2007 3:20 pm

 
Anonymous animal toons sex said...

Thanks to author.

5 November 2007 5:11 pm

 
Anonymous latina having sex said...

Hello all!

5 November 2007 5:44 pm

 
Anonymous latina anal 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 set of sex said...

Wonderful blog.

5 November 2007 6:49 pm

 
Anonymous elf joy sex said...

Good job!

5 November 2007 7:19 pm

 
Anonymous pamanderson sex tape said...

Hello all!

5 November 2007 7:50 pm

 
Anonymous bareback sex clips said...

Thanks to author.

5 November 2007 8:24 pm

 
Anonymous bard yard sex said...

Thanks to author.

5 November 2007 9:06 pm

 
Anonymous crosby park sex said...

Magnific!

5 November 2007 9:46 pm

 
Anonymous hot sex threesomes said...

Hello all!

5 November 2007 10:19 pm

 
Anonymous public dog sex said...

Thanks to author.

5 November 2007 10:50 pm

 
Anonymous maliha sex tapes said...

Change is inevitable, except from a vending machine.

5 November 2007 11:25 pm

 
Anonymous non boner sex said...

Thanks to author.

6 November 2007 12:03 am

 
Anonymous discipline humiliation sex said...

Energizer Bunny Arrested! Charged with battery.

6 November 2007 12:34 am

 
Anonymous bride sex porn said...

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

6 November 2007 1:32 am

 
Anonymous bondage sex dvd said...

Thanks to author.

6 November 2007 2:10 am

 
Anonymous adult sex style said...

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

6 November 2007 2:40 am

 
Anonymous japanese sex vids said...

Wonderful blog.

6 November 2007 3:12 am

 
Anonymous hydrochlorothiazi said...

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

6 November 2007 3:43 am

 
Anonymous cialis generic ultram pills said...

All generalizations are false, including this one.

6 November 2007 4:16 am

 
Anonymous cheap ultram said...

Suicidal twin kills sister by mistake!

6 November 2007 4:49 am

 
Anonymous japanse sex thumbs said...

The gene pool could use a little chlorine.

6 November 2007 5:28 am

 
Anonymous bestiality sex games said...

Thanks to author.

6 November 2007 6:10 am

 
Anonymous girl sex homemade said...

If ignorance is bliss, you must be orgasmic.

6 November 2007 6:48 am

 
Anonymous arizona sex offenders said...

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

6 November 2007 7:20 am

 
Anonymous all ebony sex said...

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

6 November 2007 7:53 am

 
Anonymous sex augusta ga said...

Nice Article.

6 November 2007 8:23 am

 
Anonymous daily sex pics said...

C++ should have been called B

6 November 2007 8:48 am

 
Anonymous oergon sex offender said...

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

6 November 2007 9:17 am

 
Anonymous clonazepam pms 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 dragonball z porn videos said...

Magnific!

6 November 2007 10:55 am

 
Anonymous psp xxx porn 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 animated cartoon porn said...

The gene pool could use a little chlorine.

6 November 2007 12:05 pm

 
Anonymous lezo sex pics said...

Thanks to author.

6 November 2007 12:36 pm

 
Anonymous attack sex clips said...

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

6 November 2007 1:07 pm

 
Anonymous free viedio porn said...

Magnific!

6 November 2007 1:39 pm

 
Anonymous cnn com net porn controls useless study said...

Oops. My brain just hit a bad sector.

6 November 2007 2:18 pm

 
Anonymous grayvee com free porn amateur couple fu said...

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

6 November 2007 3:03 pm

 
Anonymous dogs impacted anal glands said...

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

6 November 2007 3:37 pm

 
Anonymous fres sex stories said...

Wonderful blog.

6 November 2007 4:16 pm

 
Anonymous porn star nicknames cums alot said...

All generalizations are false, including this one.

6 November 2007 4:53 pm

 
Anonymous hentai sex xxx said...

Oops. My brain just hit a bad sector.

6 November 2007 5:24 pm

 
Anonymous ibuprofen int said...

Friends help you move. Real friends help you move bodies

6 November 2007 6:03 pm

 
Anonymous chastity video sex said...

Friends help you move. Real friends help you move bodies

6 November 2007 6:45 pm

 
Anonymous pilipino sex clips said...

Nice Article.

6 November 2007 7:29 pm

 
Anonymous busty movie sex said...

Energizer Bunny Arrested! Charged with battery.

6 November 2007 8:17 pm

 
Anonymous cartoon fun sex said...

Ever notice how fast Windows runs? Neither did I.

6 November 2007 9:01 pm

 
Anonymous free backroom sex said...

Calvin, we will not have an anatomically correct snowman!

6 November 2007 9:41 pm

 
Anonymous how to find reliable free porn said...

If ignorance is bliss, you must be orgasmic.

6 November 2007 10:28 pm

 
Anonymous internet sex dolls 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 wrestling porn said...

Please write anything else!

7 November 2007 12:11 am

 
Anonymous jock sex porn said...

If ignorance is bliss, you must be orgasmic.

7 November 2007 12:54 am

 
Anonymous pokemon sex flash said...

Magnific!

7 November 2007 1:34 am

 
Anonymous bbw porn free said...

Energizer Bunny Arrested! Charged with battery.

7 November 2007 2:13 am

 
Anonymous korean hotties sex said...

C++ should have been called B

7 November 2007 2:49 am

 
Anonymous cheerleader porn said...

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

7 November 2007 3:24 am

 
Anonymous masturbation guide anal play said...

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

7 November 2007 4:08 am

 
Anonymous parker posey sex said...

Save the whales, collect the whole set

7 November 2007 4:50 am

 
Anonymous buy inurl phentermine said...

A flashlight is a case for holding dead batteries.

7 November 2007 5:33 am

 
Anonymous buy phentermine with mastercard best online pha said...

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

7 November 2007 6:22 am

 
Anonymous buy cod online soma cheap phentermine online bu said...

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

7 November 2007 7:11 am

 
Anonymous idaho sex offender 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

 
Anonymous Anonymous said...

It likewise pays jackpot payouts, daily bonus Guide a attend at the keep you are acquiring at your end with your PC and internet connection. [url=http://www.qwepaydayloans.co.uk/]payday loans[/url] payday loans All it does do is better the Overall volatility of your du joueur dans le processus d'quilibre complexe des cartes fortes dans le jeu donn. http://www.qwepaydayloans.co.uk/

18 June 2013 7:32 pm

 

Post a Comment

<< Home