Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 08, 2011 09:00 AM by Wurzel
Jan 19, 2006 01:33 PM|LINK
maybe you can help me with the following prob:
i developped a "job search application" in asp.net 2.0 beta. it compiled and ran without any problems. now, with the new asp.net 2.0 final version, i'm getting a lot this error message:
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.
this error is only generated if you navigate quickly through the web application. that means, if you press an <asp:Button> before the whole page is loaded/rendered, then you get this posted error. if you wait until the whole
page has finished rendering, then the postback generates no errors.
i've read a lot of articles and forum posts, and nothing figured out the problem:
- NO, i'm not running a Web Farm.
- page property "EnableViewStateMac" set to false does not solve the problem, it just changes the error message
in same navigation behaviour:
The state information is invalid for this page and might be corrupted.
the second error could be solved with hotfixes/updates in asp.net 1.0/1.1
is there also a solution available for asp.net 2.0 final version?
thanks for helping!
Jan 20, 2006 11:31 AM|LINK
further information about my problem:
i've done a lot of test cases in recently past hours, following i found out concerning my problem:
it depends on which webcontrols you have in use in an asp.net 2.0 final application. my reported problem only occurs if you've nested a
gridview, a detailview or a formview within the *.aspx page. and it does not even matter if they are bound to a datasource control. they fail in both cases (bound / unbound) if you
navigate too quickly (have a look at first post for its explanation).
my problem has too be a general one in asp.net 2.0 final framework. i'm working in a small developping team for web solutions. and we've figured out that all our asp.net applications (which were running fine in asp.net beta 2.0) have this problem :-( error
message "Validation of viewstate MAC failed" occurs in simple page architecture (no masterpages, no callbacks etc.) even!
i'm sure other developers are also hit, aren't they?
although we have NO webfarm in use, i've also tried to use a self-generated <machinekey> in web.config. no success as expected ;-)
Jan 23, 2006 08:44 AM|LINK
... and again me :-)
it would also be helpful to receive replies which confirm my "observations" about this asp.net error message - even if you haven't found the solution. thanks.
Jan 24, 2006 11:35 AM|LINK
What a 'tiny' bug...
today, i found out under which exact circumstances the reported error raises.
it all belongs to the DataKeyNames property!
if you don't use this property, you will never get that "Validation of viewstate MAC failed" error by
navigating quickly (do postback before whole page has finished rendering).
so, all you need on an *.aspx page for generating this error:
* you can also do a postback with the GridView's sorting command.
that must be a bug in the .net framework! MVP users or others... what do you think about?
Jan 25, 2006 12:08 AM|LINK
Jan 25, 2006 08:06 AM|LINK
"Lots of people waiting for an answer"
glad reading this. unfortunately i've never found any articles, forum posts complaining about exactly the facts/bug i described.
i hope more people are gonna confirm this thread, so microsoft experts will give reply - thanks!
Jan 26, 2006 03:56 PM|LINK
I can confirm I get exactly the same error.
My page that errors has a GridView bound to an ObjectDataSource. This is a custom GridView which uses a dropdown outside it (with numbers 1 to 20) and an add button
next to it. This allows users to add up to 20 rows to the grid at a time. In the background each 'add' creates a new object and stuffs it into my generic list which is bound to the ObjectDataSource. Each row in the Grid has LOTS of DropDownLists, Labels, TextBox
controls, Imagebuttons etc . After you add about 30 row the page render time dramatically increase (as you'd expect). Once you edit a number of these controls and click the submit button the error occurs. The submit saves the items in my generis list to sql
then reloads itself with a empty generic list.
Validation of ViewState errors occur on our office server (when being tested) as if it were a production environment. And it doesn't happen everytime either?!?! When
I test the site using my locahost I cannot reproduce this error.
We are not using a web farm and site is built in debug mode in all cases (but will be in release mode when live on production server). This happens when you try
to submit the page even when it has DEFINITELY finished loading so how can the viewstate be different than on the server? I admit the ViewState is pretty hefty. Is this an isolated problem with GridViews and ViewState?
We have experience other problem with EventValidation. A workaround for these was to set
<pages enableEventValidation="false"/> in web.config
I have spent far too long trawling the internet for a solution but nothing!!!
Can someone at MICROSOFT please confirm if this a bug in the .net 2.0 framework and if so what can we do to STOP it!!
I need a solution FAST!
Jan 27, 2006 07:05 AM|LINK
thanks for your post. you haven't written it, but i'm very sure you also have the property DataKeyNames in your GridView in use.... and i had to laugh if i read about your EventValidation problem. i had the same problem and workaround, too :-)
so i think it's evidence enough, microsoft supporters, we'd appreciate your help!!
Jan 27, 2006 04:59 PM|LINK
I'm happy to see that I am not the only one experiencing this with .net 2.0. I love this new dev environment but it appears as though little bugs are still present with designer based controls.
I'm using a gridview bound to a SqlSource, have tried all the workarounds (MachineKey, etc) and I am still getting the error on what appears to be anything postback. When I sort my grid, the error occurs, and I assume it has to do with viewstate.
I read a MS article somewhere that explained how data conversions or formatting might have an impact (ie. converting int to string for example) but this originally appeared to be with .Net 1.0 and the article dates back some time.
I guess no sorting for the time being until this gets resolved.
If I find anything, I'll post.
Jan 30, 2006 04:16 PM|LINK
SqlDataSource GridView bound to SqlDataSource Using DataKeyNames in GridView Something on the *.aspx page which takes a while till rendered (as for example banners, external pictures etc.)
I tried to locally reproduce with these steps, and I couldn't get the same to appear. Does this happen locally or only on remote server (Windows Server 2003 utilizing application pools?) Perhaps you could show the entire page, if it is reproducable with
a small sample page.