Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
5.00/5 (4 votes)
See more:
Hello friends,

I have uploaded my web site on my domain it works fine for all features but when i try to register new member it shows the following error.

Server Error in Application.

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.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: 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.

Can anybody guide to solve this error.

Thanks in advance.
Posted
Updated 15-Dec-22 23:02pm
Comments
Sudip Saha 30-Jan-12 4:44am    
Can you please host the site in different application pool If your application pool using by many web site then that kind of problem happening
saj_21 30-Jan-12 4:51am    
I have created a virtual directory on my web server and i have hosted this site in that virtual directory.

I have one doubt :- can single domain have multiple application pools and if yes then how can i host the site in different application pool.???

I have solved this.

need to add a machinekey in webconfig
http://www.orcsweb.com/a...es/aspnetmachinekey.aspx

ASP.NET machineKey Generator[^]
 
Share this answer
 
v2
Comments
Maria Norbert 31-Oct-13 7:27am    
Can you say the reason for this error in detail..?

What is the need to add a Machine Key..?
Member 12320117 11-Feb-16 1:42am    
how to use machinekey on my windows 7 pro sp1
adding the below code in the web.config had fixed the issue for me.

C#
<pages enableeventvalidation="false" viewstateencryptionmode="Never"></pages>
 
Share this answer
 
v3
Comments
Damilola Kolawole 21-Nov-14 5:21am    
The code is case sensitive, the correct version is written below

<pages enableEventValidation="false" viewStateEncryptionMode="Never"></pages>
sasi_B 2-Jul-15 5:42am    
But I want to know will be there any security issues?
Put this code in webconfig..

HTML
<machinekey validation="SHA1" validationkey="A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1B2C3D4E5" decryption="Auto" decryptionkey="A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1" />
 
Share this answer
 
Comments
Sanket Saxena 7-May-14 2:24am    
isnt it u are very late. This is 2 yr old question.
[no name] 7-May-14 2:38am    
i am created code project account few months back thats y i didnt se thiz...
Sanket Saxena 7-May-14 2:41am    
ahh ok no issue i think so thats why i didnt downvoted buddy... happy coding :)
Codes DeCodes 4-Jun-14 1:13am    
can we simply copy and paste machinekey elements or does .net framework matters..
Paste in web config.
<system.web>
<machinekey validationkey="1234567890123456789012345678901234567890AAAAAAAAAA">
decryptionKey="123456789012345678901234567890123456789012345678"
validation="SHA1" decryption="Auto" />
 
Share this answer
 
this Happened when i tried to connect from my IIS using windows Authentication
to solve this issue create user in SQL and change the connectionString to login with this user
 
Share this answer
 
Locate the appropriate directory, depending on whether your application pool is 32-bit or 64-bit:

32-bit application pool: cd /d %windir%\Microsoft.NET\Framework\v4.0.30319

64-bit application pool: cd /d %windir%\Microsoft.NET\Framework64\v4.0.30319

Move to the directory, type the following command, and then press Enter:

aspnet_regiis -ga "IIS APPPOOL\app-pool-name"
 
Share this answer
 
Comments
Richard Deeming 16-Dec-22 8:11am    
Absolutely nothing to do with the question, which was solved nearly 11 years ago.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900