view state mac failed

N

Nalaka

Hi,
I get this error (below) under the following condition on asp.net 2.0.

I have a page that is working fine.
Then I add a JavaScript provided by "commission junction" to show an ad.



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.



Any help is very much appreciated
Nalaka
 
S

Steven Cheng[MSFT]

Hello Nalaka,

Thank you for posting in the ASP.NET newsgroup.

From your description, you have an ASP.NET 2.0 web application which is
suffering the "view state mac failed" error, also this application has use
some add-on scripts for client-side manipulation, correct?

Based on my experience, the following things may cause such exception:

1. If your application is deployed in webfarm scenario, since different
machine have different machinekey settings, it may cause viewstate mac
validation fails. BTW, ViewStateMac validation is enabed by default in
ASP.NET 2.0.

2. If you're not using webfarm setting, it is likely the page's viewstate
is modified for some reason at client-side so that when the runtime
validating it after postback, the exception thrown out. As you mentioned
that you're using some "commission junction" scripts, would you provide
some further info on these scripts or would it affect any form element in
the page's html document? For general testing, you can isolate the problem
by checking whether the problem is specific to those particular scirpts.

Hope this helps.

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead


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

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

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


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



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
S

Steven Cheng[MSFT]

Hi Nalaka,

How are you doing on this issue? Have you got any further progress or does
the info in my last reply helps you a little? If there is still anything we
can help, please feel free to post here.

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead


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

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

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


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



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
N

Nalaka

Hi Steven,
It is when I put the javascript (from commision Junction) that this happens.
It is possible the script modifies something on the client.
For now I swithced to an alternative non javascript method.

I tried various methods on the page directive (
enableEventValidation="false" viewStateEncryptionMode ="Never"
EnableViewStateMac="false" etc.)
Non of these methods was successful.

Nalaka
 
S

Steven Cheng[MSFT]

Hi Nalaka,

Thanks for your response.

The ASP.NET's ViewState is by default persisted through the

<input name="__VIEWSTAT" ... />

html hidden field. Therefore, it is likely that the commision Unction
scripts has corrupt the hidden field's value. If you can build a very
simple page to reproduce the problem, you can view the page's client-side
html source (in web browser) and check those client scripts to see whether
any of them is accessing the hidden form element.

Another troubleshooting approach is use some http trace tools (such as
fidder or tcptrace or trace utility) to capture the page's http request/
response. We can verify the <input name="__VIEWSTAT" ... /> value after it
is sent to client and before it is postback again to server. If there
value is different, there is certainly some client-script that has modified
it.

Hope this helps some.

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead


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

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

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


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



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

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

No members online now.

Forum statistics

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

Latest Threads

Top