Solved

Invalid Viewstate

Posted on 2009-07-03
4
409 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now