tags:

views:

19

answers:

1

Hi Guys,

I know this question has been asked million times but I think my situation is different here.

I am using .NET Framework 3.5 SP1, there is no form action on the page and it's not happening when I try to submit the form quickly. I am not on a web farm either.

I have a page with two GridViews. One Gridview acts as a master gridview and second as detail gridview. First Gridview has autogenerate select button and clicking select would bring related records in detail gridview at the bottom. I have a refresh Link button at the top. Everything works fine. I click refresh button and it works fine too.

Ok when problem start happening when I leave the page idle for like 10 minutes or so and then I click Refresh button only then I get this "Validation of Viewstate MAC failed" error.

I am scratching my head for the last couple of days but to no help.

Thanks

A: 

Viewstate can expire, if your application recycles and you have autogenerated machine keys turned on. Maybe that explains your problem.

ace
That sounds true. How do you tackle this situation then. How do you specify a machine key? so it remains same on postbacks.
Leo
@Leo, this doesn't happen on postbacks but when the AppDomain is recycled by the web server. Checkout the `machineKey` element in your config file (http://msdn.microsoft.com/en-us/library/ff649308.aspx) and try specifying the keys manually instead of leaving the default `Auto` setting.
Darin Dimitrov
Hi Darin, I am kind of stuck here. I don't want to change machine config file. Where do you specify machine key settings in web.config file and how can I generate a validationkey and decryptionKey?
Leo