Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Errors: Failed to load viewstate. & Validation of viewstate MAC failed.

Reply
Thread Tools

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

 
 
sck10
Guest
Posts: n/a
 
      08-31-2006
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 <machineKey> configuration specifies the same
validationKey and validation algorithm. AutoGenerate cannot be used in a
cluster.


 
Reply With Quote
 
 
 
 
KJ
Guest
Posts: n/a
 
      08-31-2006
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 <machineKey> configuration specifies the same
> validationKey and validation algorithm. AutoGenerate cannot be used in a
> cluster.


 
Reply With Quote
 
 
 
 
sck10
Guest
Posts: n/a
 
      08-31-2006
Hi KJ,

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

Thanks, sck10


"KJ" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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 <machineKey> configuration specifies the
>> same
>> validationKey and validation algorithm. AutoGenerate cannot be used in a
>> cluster.

>



 
Reply With Quote
 
KJ
Guest
Posts: n/a
 
      08-31-2006
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) 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 <machineKey> configuration specifies the
> >> same
> >> validationKey and validation algorithm. AutoGenerate cannot be used in a
> >> cluster.

> >


 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      09-01-2006
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.


 
Reply With Quote
 
sck10
Guest
Posts: n/a
 
      09-01-2006
Thanks KJ, I'll check out the site...


"KJ" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed) 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 <machineKey> configuration specifies the
>> >> same
>> >> validationKey and validation algorithm. AutoGenerate cannot be used in
>> >> a
>> >> cluster.
>> >

>



 
Reply With Quote
 
sck10
Guest
Posts: n/a
 
      09-01-2006
Steven,

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



"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. Mark B ASP .Net 2 09-11-2009 07:09 AM
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. Dhruba Bandopadhyay ASP .Net 1 05-25-2006 01:06 AM
Validation of viewstate MAC failed Ray Stevens ASP .Net 4 08-08-2005 11:02 PM
Failed to load viewstate. The control tree into which viewstate... Josema ASP .Net Building Controls 2 05-22-2005 10:38 AM
Failed to load viewstate. The control tree into which viewstate... Josema ASP .Net Web Controls 0 05-09-2005 10:58 AM



Advertisments