469,962 Members | 2,347 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,962 developers. It's quick & easy.

Errors: Failed to load viewstate. & Validation of viewstate MAC failed.

Hello,

I have applications that produce the following error when they have been
open to long without activity. Is there any way to force a re-load of the
page or go to another page if the page has expired instead of getting the
error?

Thanks,
Failed to load viewstate. The control tree into which viewstate is being
loaded must match the control tree that was used to save viewstate during
the previous request. For example, when adding controls dynamically, the
controls added during a post-back must match the type and position of the
controls added during the initial request.
Server Error in '/' Application.
Validation of viewstate MAC failed. If this application is hosted by a Web
Farm or cluster, ensure that <machineKeyconfiguration specifies the same
validationKey and validation algorithm. AutoGenerate cannot be used in a
cluster.
Aug 31 '06 #1
6 2732
KJ
A few preliminary questions: are you hosted on a web farm; if so, do
you have enableViewStateMac set to false in your Web.Config, for
example:

<pages enableViewStateMac="false"/>

sck10 wrote:
Hello,

I have applications that produce the following error when they have been
open to long without activity. Is there any way to force a re-load of the
page or go to another page if the page has expired instead of getting the
error?

Thanks,
Failed to load viewstate. The control tree into which viewstate is being
loaded must match the control tree that was used to save viewstate during
the previous request. For example, when adding controls dynamically, the
controls added during a post-back must match the type and position of the
controls added during the initial request.
Server Error in '/' Application.
Validation of viewstate MAC failed. If this application is hosted by a Web
Farm or cluster, ensure that <machineKeyconfiguration specifies the same
validationKey and validation algorithm. AutoGenerate cannot be used in a
cluster.
Aug 31 '06 #2
Hi KJ,

No, I am not on a web farm...

Thanks, sck10
"KJ" <n_**********@mail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
>A few preliminary questions: are you hosted on a web farm; if so, do
you have enableViewStateMac set to false in your Web.Config, for
example:

<pages enableViewStateMac="false"/>

sck10 wrote:
>Hello,

I have applications that produce the following error when they have been
open to long without activity. Is there any way to force a re-load of
the
page or go to another page if the page has expired instead of getting the
error?

Thanks,
Failed to load viewstate. The control tree into which viewstate is being
loaded must match the control tree that was used to save viewstate during
the previous request. For example, when adding controls dynamically, the
controls added during a post-back must match the type and position of the
controls added during the initial request.
Server Error in '/' Application.
Validation of viewstate MAC failed. If this application is hosted by a
Web
Farm or cluster, ensure that <machineKeyconfiguration specifies the
same
validationKey and validation algorithm. AutoGenerate cannot be used in a
cluster.

Aug 31 '06 #3
KJ
In this case, I don't have a correct answer for you. You could try the
following links:

http://www.andreas-kraus.net/blog/va...te-mac-failed/
http://dotnetjunkies.com/WebLog/thom...06/139890.aspx

sck10 wrote:
Hi KJ,

No, I am not on a web farm...

Thanks, sck10
"KJ" <n_**********@mail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
A few preliminary questions: are you hosted on a web farm; if so, do
you have enableViewStateMac set to false in your Web.Config, for
example:

<pages enableViewStateMac="false"/>

sck10 wrote:
Hello,

I have applications that produce the following error when they have been
open to long without activity. Is there any way to force a re-load of
the
page or go to another page if the page has expired instead of getting the
error?

Thanks,
Failed to load viewstate. The control tree into which viewstate is being
loaded must match the control tree that was used to save viewstate during
the previous request. For example, when adding controls dynamically, the
controls added during a post-back must match the type and position of the
controls added during the initial request.
Server Error in '/' Application.
Validation of viewstate MAC failed. If this application is hosted by a
Web
Farm or cluster, ensure that <machineKeyconfiguration specifies the
same
validationKey and validation algorithm. AutoGenerate cannot be used in a
cluster.
Aug 31 '06 #4
Hello Steve,

From your description, the problem occurs when the page has been idle for
long time. Does it occur when the page is display in short time and be
fresh? For long time idle page, I think the exception is likely due to the
viewstate MAC has been expired and the server runtime can not validate it.
ASP.NET will perform a simple digest on the viewstate and check it later
when page postback, however, this digest is not valid forever, after long
period, it could refresh it. I've also seen some one encountering such
problem when using page cached in google page cache.

For your another question:
================
Is there any way to force a re-load of the
page or go to another page if the page has expired instead of getting the
error?
================

Do you think use client-side script to set a timer and postback/reload the
page after a certain periold workable for you? e.g.

#the following page use script to reload the page after 20 secs
==================
....................
<script type="text/javascript">
function client_onload()
{
window.setTimeout("refresh_page()", 20000);
}

function refresh_page()
{
window.location.href = window.location.href;
}
</script>
</head>
<body onload="client_onload();">
<form id="form1" runat="server" >
<div>
..............
===============

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Sep 1 '06 #5
Thanks KJ, I'll check out the site...
"KJ" <n_**********@mail.comwrote in message
news:11**********************@74g2000cwt.googlegro ups.com...
In this case, I don't have a correct answer for you. You could try the
following links:

http://www.andreas-kraus.net/blog/va...te-mac-failed/
http://dotnetjunkies.com/WebLog/thom...06/139890.aspx

sck10 wrote:
>Hi KJ,

No, I am not on a web farm...

Thanks, sck10
"KJ" <n_**********@mail.comwrote in message
news:11**********************@e3g2000cwe.googlegr oups.com...
>A few preliminary questions: are you hosted on a web farm; if so, do
you have enableViewStateMac set to false in your Web.Config, for
example:

<pages enableViewStateMac="false"/>

sck10 wrote:
Hello,

I have applications that produce the following error when they have
been
open to long without activity. Is there any way to force a re-load of
the
page or go to another page if the page has expired instead of getting
the
error?

Thanks,
Failed to load viewstate. The control tree into which viewstate is
being
loaded must match the control tree that was used to save viewstate
during
the previous request. For example, when adding controls dynamically,
the
controls added during a post-back must match the type and position of
the
controls added during the initial request.
Server Error in '/' Application.
Validation of viewstate MAC failed. If this application is hosted by a
Web
Farm or cluster, ensure that <machineKeyconfiguration specifies the
same
validationKey and validation algorithm. AutoGenerate cannot be used in
a
cluster.

Sep 1 '06 #6
Steven,

Thanks for the timer script. That may be the solution I need...

"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:Yi**************@TK2MSFTNGXA01.phx.gbl...
Hello Steve,

From your description, the problem occurs when the page has been idle for
long time. Does it occur when the page is display in short time and be
fresh? For long time idle page, I think the exception is likely due to the
viewstate MAC has been expired and the server runtime can not validate it.
ASP.NET will perform a simple digest on the viewstate and check it later
when page postback, however, this digest is not valid forever, after long
period, it could refresh it. I've also seen some one encountering such
problem when using page cached in google page cache.

For your another question:
================
Is there any way to force a re-load of the
page or go to another page if the page has expired instead of getting the
error?
================

Do you think use client-side script to set a timer and postback/reload the
page after a certain periold workable for you? e.g.

#the following page use script to reload the page after 20 secs
==================
...................
<script type="text/javascript">
function client_onload()
{
window.setTimeout("refresh_page()", 20000);
}

function refresh_page()
{
window.location.href = window.location.href;
}
</script>
</head>
<body onload="client_onload();">
<form id="form1" runat="server" >
<div>
.............
===============

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.


Sep 1 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by John Kirksey | last post: by
5 posts views Thread by russell.lane | last post: by
6 posts views Thread by Gibble | last post: by
5 posts views Thread by SpaceMarine | last post: by
3 posts views Thread by sck10 | last post: by
1 post views Thread by daveh551 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.