You must Sign In to post a response.
  • Category: .NET

    Validation of viewstate MAC failed on 1st Time in Login Page.

    I have using ASP .Net C# application. In Login Page for 1st time this issue arises and after refresh the page the error is goes out. The error get on browser Console.
    I googling on that and already added the MAC Key in web config but no result found.

    The Below Issue Found :

    "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".
  • #768162
    Hi Jay,

    As you mentioned that you have already added the MachineKey and it is not working.
    Can you kindly test the below methods.

    1. Create a New application Pool and Application Site. Delete the existing and create a new one freshly and try.
    2. Have you added the enable event validation in the pages as False?


    <pages enableeventvalidation="false" viewstateencryptionmode="Never"></pages>



    3. Machine Key hope you are generated from the IIS Server under the Machine Key tab with a Generate Key. If not perform once again like that and also check you have pasted the machine config in the right area.

    Thanks,
    Mani

  • #768170
    Change in machine.config is not always advisable, as it affect all sites of IIS. You can try out following work arounds
    1. In the AppPool -> Advanced settings of the web site, ensure that you didn't modify the Maximum Worker Process to a value bigger than 1.
    2. Try to set 'Page.EnableViewStateMac ' property to false (it Gets or sets a value indicating whether ASP.NET should check message authentication codes (MAC) in the page's view state when the page is posted back from the client.)
    3. Many times we have just copy paste Aspx file from one page to another , that time we have forget to change INHERITS Attribute in ASPX or action part in FORM tags, try to check that part also.

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #768176
    Hi I tested exactly as of the comments guys but not freeze my issue, however is that necessary to create machine key as I am not using Web Farm. So why it is necessary to create.


  • Sign In to post your comments