473,574 Members | 2,588 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 #1
29 8435
This is the stack with the error message. I have removed the viewstate to
save on some space, it definitely looks like it is truncating the viewstate
though:

<Exception>Syst em.Web.HttpExce ption: Invalid_Viewsta te
Client IP: 64.167.38.121
Port: 1531
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
CLR 1.1.4322)
ViewState:
Http-Referer:
Path: /Reports/Default.aspx. ---> System.Web.Http Exception: 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 back to the same page. 3) The viewstate for this page might be
corrupted. ---> System.Web.Http Exception: Unable to validate data.
at System.Web.Conf iguration.Machi neKey.GetDecode dData(Byte[] buf, Byte[]
modifier, Int32 start, Int32 length, Int32& dataLength)
at System.Web.UI.L osFormatter.Des erialize(String input)
--- End of inner exception stack trace ---
at System.Web.UI.L osFormatter.Des erialize(String input)
at System.Web.UI.P age.LoadPageSta teFromPersisten ceMedium()
--- End of inner exception stack trace ---
at System.Web.UI.P age.LoadPageSta teFromPersisten ceMedium()
at System.Web.UI.P age.LoadPageVie wState()
at System.Web.UI.P age.ProcessRequ estMain()</Exception>

"Chris Sutton" wrote:
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 #2
We have found two ways this error can be reproduced now. If you have a page
that has been served with viewate in it, and then you change the credentials
on the worker process, it will throw a viewstate error when you post back.

Also, if the worker process recycles in between posts on a given page (a
fairly common scenario) we are throwing a viewstate error.

Once again, this is a single server (not a garden or farm). It is a two
processor server though, if that makes a difference.

The second scenario seem like it would more likely be our problem. But why
would a recycled worker process cause a viewstate error?

Any suggestions here would be great.

Chris

"Chris Sutton" wrote:
This is the stack with the error message. I have removed the viewstate to
save on some space, it definitely looks like it is truncating the viewstate
though:

<Exception>Syst em.Web.HttpExce ption: Invalid_Viewsta te
Client IP: 64.167.38.121
Port: 1531
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
CLR 1.1.4322)
ViewState:
Http-Referer:
Path: /Reports/Default.aspx. ---> System.Web.Http Exception: 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 back to the same page. 3) The viewstate for this page might be
corrupted. ---> System.Web.Http Exception: Unable to validate data.
at System.Web.Conf iguration.Machi neKey.GetDecode dData(Byte[] buf, Byte[]
modifier, Int32 start, Int32 length, Int32& dataLength)
at System.Web.UI.L osFormatter.Des erialize(String input)
--- End of inner exception stack trace ---
at System.Web.UI.L osFormatter.Des erialize(String input)
at System.Web.UI.P age.LoadPageSta teFromPersisten ceMedium()
--- End of inner exception stack trace ---
at System.Web.UI.P age.LoadPageSta teFromPersisten ceMedium()
at System.Web.UI.P age.LoadPageVie wState()
at System.Web.UI.P age.ProcessRequ estMain()</Exception>

"Chris Sutton" wrote:
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 #3
Chris,
This is not the case. The viewstate issue seems to be a new issue that I am
digging into. If you have any other relevant information, please don't
hesitate to send it to me at va******@hotmai l.com subject: Invalid Viewstate

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc
"Chris Sutton" <Ch*********@di scussions.micro soft.com> wrote in message
news:62******** *************** ***********@mic rosoft.com...
We have found two ways this error can be reproduced now. If you have a
page
that has been served with viewate in it, and then you change the
credentials
on the worker process, it will throw a viewstate error when you post back.

Also, if the worker process recycles in between posts on a given page (a
fairly common scenario) we are throwing a viewstate error.

Once again, this is a single server (not a garden or farm). It is a two
processor server though, if that makes a difference.

The second scenario seem like it would more likely be our problem. But
why
would a recycled worker process cause a viewstate error?

Any suggestions here would be great.

Chris

"Chris Sutton" wrote:
This is the stack with the error message. I have removed the viewstate
to
save on some space, it definitely looks like it is truncating the
viewstate
though:

<Exception>Syst em.Web.HttpExce ption: Invalid_Viewsta te
Client IP: 64.167.38.121
Port: 1531
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
CLR 1.1.4322)
ViewState:
Http-Referer:
Path: /Reports/Default.aspx. ---> System.Web.Http Exception:
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 back to the same page. 3) The viewstate for this page might be
corrupted. ---> System.Web.Http Exception: Unable to validate data.
at System.Web.Conf iguration.Machi neKey.GetDecode dData(Byte[] buf,
Byte[]
modifier, Int32 start, Int32 length, Int32& dataLength)
at System.Web.UI.L osFormatter.Des erialize(String input)
--- End of inner exception stack trace ---
at System.Web.UI.L osFormatter.Des erialize(String input)
at System.Web.UI.P age.LoadPageSta teFromPersisten ceMedium()
--- End of inner exception stack trace ---
at System.Web.UI.P age.LoadPageSta teFromPersisten ceMedium()
at System.Web.UI.P age.LoadPageVie wState()
at System.Web.UI.P age.ProcessRequ estMain()</Exception>

"Chris Sutton" wrote:
> 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 #4
We're experiencing the same issue. The servers are within a cluster,
but we have a hardware load balancer that assures client-server
affinity based on client IP address, so I don't think it's an issue of
viewstate posting back to a different server.

Any resolution or suggestions on what may be causing this error would
be greatly appreciated.

Nov 19 '05 #5
working on it still, no resolution yet. more and more incidents are starting
to pop up.

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc
<ma**********@g mail.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
We're experiencing the same issue. The servers are within a cluster,
but we have a hardware load balancer that assures client-server
affinity based on client IP address, so I don't think it's an issue of
viewstate posting back to a different server.

Any resolution or suggestions on what may be causing this error would
be greatly appreciated.

Nov 19 '05 #6
Try this...

Protected Overrides Sub SavePageStateTo PersistenceMedi um(ByVal
viewState
As Object)

Dim _formatter As New LosFormatter

Dim key As String = Request.Url.ToS tring & "__VIEWSTAT E"
Dim memStream As New System.IO.Memor yStream
_formatter.Seri alize(memStream , viewState)
memStream.Flush ()
Session(key) = memStream

End Sub

Protected Overrides Function LoadPageStateFr omPersistenceMe dium()
As Obj
ect

Dim _formatter As New LosFormatter
Dim key As String = Request.Url.ToS tring & "__VIEWSTAT E"

If Not Session(key) Is Nothing Then
Dim memStream As System.IO.Memor yStream = _
CType(Session(k ey), System.IO.Memor yStream)
memStream.Seek( 0, IO.SeekOrigin.B egin)
Return _formatter.Dese rialize(memStre am)
End If

End Function
Best,

Daniel Pak

Nov 19 '05 #7

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 i
every code behind page? or just in the global?

Regard

--
schott1
-----------------------------------------------------------------------
schott19's Profile: http://www.msusenet.com/member.php?userid=59
View this thread: http://www.msusenet.com/t-186940149

Nov 19 '05 #8
P.J
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 #9
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 #10

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

Similar topics

3
1915
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
15534
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...
1
2134
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...
2
1692
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
2187
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
5046
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
1918
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...
1
2359
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...
0
7814
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...
0
8075
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8253
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...
0
8109
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...
0
6471
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...
1
5632
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5316
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...
1
1356
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1072
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.