473,790 Members | 2,481 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Invalid_Viewsta te

I have a production asp.net application that is getting seemingly random
Viewstate errors.

It is a single server, so there isn't any issue with posting viewstate to a
different server that what it was received from. Also, it happens with users
that have to go through a firewall and users that don't.

It happens across the a broad array of pages, most of them are simple grid
pages that you can drill down into to collect more input data.

Also, the viewstate size is typically 5-30K depending on the page. Never
gets anywhere near 1024K.

We have also installed sp1 for the 1.1 release of the .net framework, so we
can collect more detailed viewstate errors.

I'll post the most typical error that we get in a follow up message.

If anybody knows what actually causes this I would be very interested in
knowing. A resolution would be even better.

Chris Sutton
Nov 19 '05
29 8467
I'm aware that the application pool restarts cause this issue. However, I
also have this error occuring on a server where application pools are not
allowed to recycle under any circumstance.

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc
"P.J" <pj*********@sn clavalin.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
We, too, are experiencing 'Invalid_Viewst ate' error since a couple of
weeks. I have been investigating the problem lately, and this is what
I have to say about it:

-All development servers (virtual servers) and development workstations
do not have the problem. As someone mentionned, the problem is only on
the production server (no farm here - single server setup): a multi-cpu
Xeon (hypethreading) machine. I've asked to replicate the production
environment in a lab test on the same hardware (or almost the same) and
I succeeded in replicating the problem: Each time the the worker
process of an application pool shuts down, any Post made to a web page
already in-session in IE would result in the error. So I've asked to
remove all cpus except one, and to disable HT on it, just to check if
any relation could be made. No succes, the error still happens.

-Next item that I did check is the Application Pool security. On
development servers, the IIS Application Pool identity is always set to
the default Network Service and I can not replicate the error on them.
On the production server though, we set up the Application Pool to run
with a NT Domain service account and the application works just fine.
We do that so our application data layer can communicate with the
database through a trusted SQL connexion (thus avoiding the dilema of
having a userid and password in clear text somewhere in the web.config
file - like we do in development environment). So what I did this
morning is to set back (on the production environment in the lab) the
identity of Application Pool of our application to Network Service: the
problem is gone and I can not replicate it.

So what I can conclude right now is that there is some problem in the
way the security context of an Application Pool is applied to the
validation of an ASP.NET Viewstate when the worker process of the pool
shuts down for being idle.

As a work around I did last week is to 'uncheck' the 'Idle timeout'
from the Application Pool so people here won't experiment the error.
And I also set the application to recycle each night when no one is
using it.

I hope that this can help someone in some ways, and also help gurus
pinpointing the problem and fix it.

Our setup is:
Windows Server 2003 Standard
.Net Framework 1.1 + SP1 + SP1 Update
Application is developed in C# and we are using some of MS Application
Blocks (Data Access, Exception, etc)

Workstation are XP and 2000 and are using IE6 with the latest patches.

Nov 19 '05 #11
Hi schott19,

Add it to your code-behind pages, and let me know if that help solve
the problem.

Best,

Daniel Pak
schott19 wrote:
Hi Dan,

Thnaks for the code snippet. Looks like it could be promising.

I am also having the viewsate problem. Does this code need to go in
every code behind page? or just in the global?

Regards
--
schott19
------------------------------------------------------------------------ schott19's Profile: http://www.msusenet.com/member.php?userid=593
View this thread: http://www.msusenet.com/t-1869401494


Nov 19 '05 #12
Hello Daniel,

I added your code snipped to my Base code-behind page, but then I wasn't
getting the error but the application was behaving very strange.
Randomly, it would log the user out and the refreshing that page would
automatically log them back in.

I am using Server.Transfer to redirect from one page to another to take
advantage of adding querystring values to the Context and this problem
only seems to happend on the destination page of the Server.Transfer .

Any help would be appreciated.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #13
Hi Huzaifa,

Are you adding data to the context object before transferring?

Ex. in WebForm1.aspx:
Context.Items(" myParameter") = x
Server.Transfer ("WebForm2.aspx ")

Then, in WebForm2.aspx:
Grab data from the context property
Dim x as Integer = CType(Context.I tems("myParamet er"),Integer)

Nov 19 '05 #14
Hello Daniel,

Yes I am adding variables to the Context before transferring so that I
don't have to pass them in through the Query String.

This seems to be working fine on my development box but not on the
production Windows 2003 box.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #15
P.J
Well finally through our support with HP and Microsoft, I finally got
these answers in relation with the Identity of an Application Pool on
IIS 6.0:

=============== =============== =============== =====
There are two registry keys that are significant:

HKEY_LOCAL_MACH INE\Software\Mi crosoft\ASP.NET
HKEY_CURRENT_US ER\Software\Mic rosoft\ASP.NET

When machineKey is set to AutoGenerate, the key information is stored
in the
HKEY_CURRENT_US ER hive for the account running the process. When the
process
launches, ASP.NET will use the HKEY_CURRENT_US ER registry key if it is
available, but will fall back to the
HKEY_LOCAL_MACH INE key if it is not. If neither registry key exists,
the process
creates the key in the HKEY_LOCAL_MACH INE hive. Otherwise a new set of
keys is generated.
There is some logic that checks to ensure that the key was created
after the
install time for ASP.NET as well so updates will cause a new key.

Now is the catch:

When the application pool is running under a user account (** my case
**) the above keys are NOT generated and you get the VIEWSTATE error.
Running as an administrative level account or Network Service does NOT
return a viewstate error.

MORE INFORMATION:
=============== =============== ======
IIS does not load an explicit user profile hive for the worker process.
The Service
Control Manager loads the user profile hive for network service so this
area is
available, but custom accounts do not. As a result, there is not an
HKCU hive (or
any other innate writable location) in which to persist keys. There is
work being
done in ASP.NET 2.0 to try and provide a place to persist this type of
data for
other accounts.

The workaround is to use a specific key in the machine.config so the
key will not
be generated on each process start. You can also disable the IIS
health features
that you do not explicitly need to reduce the probability of running
into the
situation. As we discussed before, using the key in the machine.config
is common
since it is required in web farm scenarios.
=============== =============== ======

So now I going to try the machine.config key solution and makes some
tests.

Nov 19 '05 #16
Would we be able to add this key (if the solution works) to the
web.config file rather than the machine.config since the machine belongs
to a web host?

Can you provide a sample of the snipped that goes into the
machine.config file? Since I myself work at a web hosting company I had
the opportunity to switch the application pool of my website to Network
Service, however, ASP.NET did not like that.

Thanks for the great info. Will be waiting for your results.
*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #17
EnableViewState Mac
Indicates that ASP.NET should run a machine authentication
check (MAC) on the page's view state when the page is
posted back from the client. true if view state should
be MAC checked; otherwise, false. The default is false.

Note A view state MAC is an encrypted version the hidden
variable that a page's view state is persisted to when sent
to the browser. When you set this attribute to true, the
encrypted view state is checked to verify that it has not
been tampered with on the client.

Nov 19 '05 #18
We can turn off the EnableViewState Mac in the web.config or machine
level in machine.config, however, that is not reccommended since
ViewState then can be tampered with.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #19
P.J
I successfully tested the solution by adding a key in the
machine.config file of the server.

I use this link to make a small console application (in C#) to generate
a key (SHA1):
http://support.microsoft.com/default...;en-us;Q312906

Then I updated the machine.config file under the system.web section
with the output produce and tried to make the Invalid_Viewsta te error
come up again. But it didn't show up, so it is an acceptable solution
for us.

I agree that on a commercial hosting server, this solution might not be
appropriate since every web site will share the same key. I have no
answer for that beside disabling the application pool 'health' feature,
but then, you lose the advantage of using Windows 2003 and IIS 6.

Nov 19 '05 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1933
by: Jennyfer J Barco | last post by:
Hello I'm sending this again since I didn't have any answer 5 days before I sent this e-mail. Hello, Sometimes I'm getting this Application error: Error:Invalid_Viewstate Client IP: 10.0.2.238 Port: 4436 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR
2
271
by: Arne | last post by:
The errror message System.Web.HttpException: Invalid_Viewstate has increased in frequency since I moved from Windows 2000 server to Windows 2003 server. Now I may get 16 of these errors a day compared to a few a week. What can I do about this error?
3
15554
by: some one | last post by:
I have kind of wired problem, I using httpwebrequest to post form data to server , in the GetResponse stage a WebException occurred, after tracing the actual error that occurs on the server, I found the follows. Invalid length for a Base-64 char array. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about
1
2151
by: dima | last post by:
Hi All, I know some of you had this problem in production. Did anyone find out how to fix this problem or what is the cause of it? System.Web.HttpException: Invalid_Viewstate System.Web.HttpException: Authentication of viewstate failed. 1) If this is a cluster, edit <machineKey> configuration so all servers use the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. 2) Viewstate can only be posted...
2
1700
by: InnoCreate | last post by:
Hi Everyone, Occasionally i'm getting the following error logged. I've heard this can be caused by proxy servers. Does anyone know anyways to resolve the issue or anything else that could cause the issue. Thanks James
1
2199
by: Bill Sempf | last post by:
Trying again on this forum to see if anyone has seen this error: I am receiving an Invalid_Viewstate error on one of my sites, and the error message content has SMTP Mail header text in it! Here is an example from my exception handler: --------------------------------------------------------- Date: 3/27/2006 3:18:09 AM
1
5056
by: adrian.besimi | last post by:
Hi, I got a serious problem regarding the Server.Execute and/or Server.Transfer. Here's the idea of my application: I have 1 web page named Default.aspx where I execute all my other pages.
1
1928
by: =?Utf-8?B?UGF1bCBQaGlsbGlwcw==?= | last post by:
I have read many things about this but I haven't got a clear vision on what to do if anything about this. I have a system that tries to find holes in my web site. One of the things it has found and has been sent to me is an Invalid_Viewstate exception. I will provide the stack trace below. If you read down the stack trace it talks about "Invalid chararcter in a base-64
1
2375
by: =?Utf-8?B?UGF1bCBQaGlsbGlwcw==?= | last post by:
I have read many things about this but I haven't got a clear vision on what to do if anything about this. I have a system that tries to find holes in my web site. One of the things it has found and has been sent to me is an Invalid_Viewstate exception. I will provide the stack trace below. If you read down the stack trace it talks about "Invalid chararcter in a base-64
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10145
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9986
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9021
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5422
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.