Solved

Invalid Viewstate

Posted on 2009-07-03
4
412 Views
Last Modified: 2012-05-07
My application is .net 2.0.  I have around 40 sites running the same app for multiple customers.  I get intermittant invalid viewstate errors that affect stability of the app.  I have researched this, but not found a solution.

1. The app is running on my own server.
2. I use NLM, but only one server is active.  It is for backup purposes to redirect to a backup server.
3. I am on .Net 2.0
4. I have added a machine key to the web.config for all sites (below).  This didn't make a difference.
5. From my application log, I see the error (at least sometimes) happens on the initial post to a form.  For example, I click on a menu link to open a new form, and I get the error.
6. I don't have any anti-virus software running on the server.
7. The error happens too often to assume that is is a App Pool recycle error.

There is a lot written about this error, but I can't seem to find the issue.  Help!
<machineKey validationKey="1111111111111112CAD731F96F1ABC096D05090C9AD6623AB99C56ADB7E774045CC6AD2D86A24FD8BE8BA19E809E35ACA5BAD28B4762EC126471BA373CB28628"
                decryptionKey="30866BB7F1D1B392A17F675CD6425C83FB90351365D82AA5" 
                validation="SHA1" />
 
Some values were changed for this post

Open in new window

0
Comment
Question by:No1Coder
  • 2
4 Comments
 
LVL 39

Expert Comment

by:abel
ID: 24937060
Sometimes there's only so much you can do. Once I remember having a similar problem and after hours of research I found out that when I did a forced redirect with NoStore header set, all went fine. Not a nice solution, but it at least took away the errors from the clients.

Later I found out that there was one control (a label in my case) that disrupted the process. Apparently the label state was remembered in the viewstate. By disabling the viewstate for a few specific controls I managed to stop the error.

Not sure if this approach is something for you, but it may be a workable solution if you do not want to lower your security to something that allows the passing of these viewstates. You can catch the error globally through either global.asax or registering a thread error handler.

-- Abel --
0
 
LVL 20

Expert Comment

by:informaniac
ID: 25012845
Have u used Client Callback anywhere in ur application?

Or are using javascript to call a server side event. say button click?
0
 

Accepted Solution

by:
No1Coder earned 0 total points
ID: 25013455
I worked with Microsoft on this.  Moving the page_load code to page_init helped.  Also, turning off viewstate on some grids helped.  I can;t say it is fixed, but the number of instances have been greatly reduced.
0
 
LVL 39

Expert Comment

by:abel
ID: 25016777
They haven't been able to pinpoint one particular problem or issue in your code that caused this erratic behavior? Must be quite disappointing, though glad to hear that you got it partially resolved.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Calculate number of nights between two dates 5 53
MailAddress in vb 4 29
IEnumerable<T> to a List<T> 8 37
how to just get time from a date 6 32
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question