Solved

Invalid Viewstate

Posted on 2009-07-03
4
415 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

705 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