CFF KB - Carrz-Fox-Fire Promotions Knowledge Base
CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.Knowledge Base
- Breadrumbs:
ASP.NET Validation of viewstate MAC failed.
- Article ID:
177 - Date Created
Friday, July 27, 2012 - Last Updated
Friday, July 27, 2012 - This Article Has been Viewed
1946 times - Short Desc
Validation of viewstate MAC failed will happen if you do not have a Machine Key for your site. Follow these simple instructions to generate a Machine Key for your ASP.NET site. - Details
When you are developing your ASP.NET application on a server that is shared, or for better words, on a clustered environments or web farm, then you might experience the following 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. - Recreate Issue
To recreate this issue:
This issue will happen if you do not have a Machine Key for your site. - Resolve Issue
To resolve this issue.
Creating a Machine Key
The database.config and encryption.config files are saved in an encrypted form,
so that your connection string and encryption key remain protected. If you are installing
AbleCommerce to a web farm or clustered environment, you must take additional steps so that
this file encryption will work properly.
You may experience a problem with having to continuously login.
You may also experience MAC validation errors.
If this happens, follow the steps below:
#1: Visit this URL: http://aspnetresources.com/tools/keycreator.aspx«
#2: The default values for key generation are correct (64/24/SHA1), click Generate
#3: Copy the resulting machine key.
#4: Open the web.config for the store, and paste the copied machine key after the line that says
<system.web>
Save web.config and restart the IIS application service.
When you don’t specify the machine key in web.config, ASPNET automatically generates one for the application.
If something causes the application to recycle, the key is regenerated.
If the application recycles between requests, then any data that was downloaded by the browser was
recorded with the first key, and validated with the second.
This turns into the MAC validation error, because the keys are not the same.
This is why the error mentions clustered environments, because the same issue occurs if
you move from one server to another between requests.
When you set the key in the web.config file, ASPNET uses this key rather than auto generating.
That ensures that even if an application recycle takes place, the validation will be correct.
This is used for things like session cookies, authentication, viewstate validation,
event validation, and so on.
For more information on this article, please refer to its source.
@ help.ablecommerce.com«
Share With Friends (Updated 6-8-2010)
Recent Articles
All Topics
- Coming Soon - Knowledge Exchange
Trending Articles
- Microsoft VBScript runtime error '800a0046' Permission denied FileSystemObject 24695
- Microsoft OLE DB Provider for SQL Server error '80040e57' String or binary data would be truncated. or The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. 21297
- ADODB.Parameters error '800a0e7c' Parameter object is improperly defined 19544
- After Effects warning: Audio conforming failed for the following file .cfa. Perhaps due to disk space 17785
- The backup set holds a backup of a database other than the existing 16826