Hello. Thanks for visiting.

Have questions about Server Intellect?

I'm here to help.

Call us toll free at 1-855-850-HOST(4678)

Coupon code copied
Server Intellect
(855) 850-HOST

Toll Free 24/7/365        (4678)

Get help from a Microsoft Certified Engineer.

Intellect Connect

Technical problem with your Windows Hosting?

Let our Microsoft Certified experts handle the problem for you.
Chat Now

How do I Add a Static MachineKey to my Cloud Hosted Website?

With Hosted Websites running on our Public Cloud platform, a site will not always be running from the same server, due to the way the infrastructure is engineered. This does not mean the content of the sites change, but the server on which the actual ‘w3wp.exe’ process may change servers occasionally depending on current load and physical resources, in order to maintain the best possible performance.

However, when it comes to login sessions for specific sites, such as a shopping cart or message board forum, if the user is logged in when the site is moved between servers, the end user may experience an ASP.NET error related to ‘Invalid Viewstate’. All ‘web.config’ files use what is called a ‘MachineKey’, which is an element to control tamper proofing and encryption of ViewState, forms authentication tickets, and role cookies.

When a site is running on a single server, the ‘MachineKey’ element can be set to auto-generate encryption values from the server itself, and this works without any issue. Yet, when the site’s worker process is moved between servers, this value changes when it is auto-generated, hence causing the ‘Invalid ViewState’ errors.

There is a method of resolving this issue, and that is by implementing a static MachineKey into the site’s ‘web.config’ file, so that no matter what server the worker process is running from, the encryption and decryption algorithm will remain the same, preventing the ‘Invalid ViewState’ errors.

There are many sites on the Internet which you can use to generate a static MachineKey, such as the URL below:

http://aspnetresources.com/tools/machineKey

Once you have generated the MachineKey, you will need to implement it into your ‘web.config’ file.

Before making any alterations to the ‘web.config’ file, it is best practice to always create a backup of the file, so the changes can be easily reverted if need be.

Once you have a backup copy of the file created, open it and find the ‘machineKey’ section, overwriting the existing code.

From there, you can copy and paste code generated from the above URL, or any site which can perform machineKey generation, and paste it into the ‘web.config’ file.

Saving the file will cause your site’s application pool to recycle, however once it is back, the issue should be resolved.

If you need any assistance with this process at all, please don’t hesitate to contact our Technicial Support Department.

Interested in letting our experts solve your IT problems for you?
Get a free, no-obligations consultation with one of our experts today!

Call us at (855) 850-HOST

Chat Now

Start Your Order

X

This form does not accept free e-mail accounts. Please enter a business e-mail to submit it.

Submit Form Cancel

Please wait...

Submitting your info. This may take less than a minute.