SharePoint 2013: ViewState cache was discontinued on August 2014


During troubleshooting any Sharepoint issues , you might have noticed that the size of the body in the POST requests may increase considerably from a few KB (kilobytes) to hundreds of KBs after you apply October 14, 2014 update for SharePoint Server 2013 (KB2889930) or a later CU.
The state of the webparts are maintained between post backs via a mechanism called ViewState which is a serialized version of the objects sent back and forth via a FORM hidden field called __VIEWSTATE. SharePoint prior to version 15.0.4653.1000 by default used to save the ViewState in AppFabric cache (a.k.a. ViewState Cache) keeping only a key to this ViewState in the __VIEWSTATE hidden field. This behavior was causing the state to be lost in some situations like during an update or when AppFabric was restarted.
Resolution
The occasional increase of the ViewState size is not a problem for most situations and can be ignored. Pages containing Out-Of-The-Box (OOB) SharePoint webparts holds very little information in ViesState. For some environments with custom webparts, the size can increase dramatically and it may be desirable to persist state another way. For these environments. We suggest to persist ViewState using regular ASP.NET techniques. See more in “More Information” section.
More Information
POST BY : Rodney Viana [MSFT]

Comments (2)

  1. Piotr Siódmak says:

    A simple solution for viewstate disappearing was to use [Microsoft.SharePoint.Administration.SPWebService]::ContentService.ViewStateOnServer = $true which kicks viewstate from dcache back to the page’s html. I see that in SharePoint 2016 this is still available and set to true. Is it still relevant or does the property do nothing now?

  2. Hi Piotr,

    All code related to the implementation of ViewState on dcache was removed, but the properties and settings are still there for back compatibility. They will not alter the ViewState behavior though. So answering your question, the property does nothing now.

Skip to main content