Validation of viewstate MAC failed - only on windows CE device

J

Jeremy Chapman

This is odd behavior. In my aspnet 2.0 app (basic app, nothing out of the
ordinary here), if I am using my iPAQ handheld device and I hit the refresh
button on my page, I get an error "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."

The interesting thing is I can not reproduce this using IE or Opera on my
desktop. The user agent reported by my iPAQ browser is "Mozilla/4.0
(compatible; MSIE 4.01; Windows CE; PPC; 240x320)"

I also tried adding the following machineKey to my macine.config file, which
didn't help:

<machineKey
validationKey="9CCEC30E6D1695636BC548918FC190EAC06714B6B44CCA2168B7DB439EC6684025E84514A8298545E74B015E22B69B1C3DD845F237BE470FC5650182F46B9111"
decryptionKey="126EA9F8AD6016492548AA59BAEB5D8012B947145126A19A"
validation="SHA1"/>

Any ideas?
 
J

Jeremy Chapman

I figured out what the issue was. In some environments (IE on a windows CE
device, in my case) hidden fields can only be a certain length. I don't
know what the length is, but in some of my pages I must have exceeded it. I
turned event validation off in the web config, and I made the page store the
viewstate in the session. Storing the viewstate in the session can cause a
wrinkle when using the back button -which I don't have a solution for yet,
but at least I'm not getting these errors.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top