view state mac failed

Discussion in 'ASP .Net' started by Nalaka, Jul 6, 2006.

  1. Nalaka

    Nalaka Guest

    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
     
    Nalaka, Jul 6, 2006
    #1
    1. Advertising

  2. 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.)
     
    Steven Cheng[MSFT], Jul 7, 2006
    #2
    1. Advertising

  3. 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.)
     
    Steven Cheng[MSFT], Jul 11, 2006
    #3
  4. Nalaka

    Nalaka Guest

    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


    "Steven Cheng[MSFT]" <> wrote in message
    news:...
    > 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.)
    >
     
    Nalaka, Jul 11, 2006
    #4
  5. 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.)
     
    Steven Cheng[MSFT], Jul 12, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sck10
    Replies:
    6
    Views:
    963
    sck10
    Sep 1, 2006
  2. kiran
    Replies:
    5
    Views:
    3,560
  3. VijayRama

    Failed to load view state

    VijayRama, Oct 10, 2009, in forum: ASP .Net
    Replies:
    1
    Views:
    492
    Gregory A. Beamer
    Oct 12, 2009
  4. Tony Johansson
    Replies:
    3
    Views:
    16,502
    Patrice
    Jan 2, 2010
  5. Parthiv Joshi
    Replies:
    1
    Views:
    821
    Samuel L Matzen
    Jul 6, 2004
Loading...

Share This Page