I was using ViewState in custom developed SharePoint Solution to store date before saving to List because of some requirements. I found that the ViewState value was getting null after some duration which again was unable to meet my requirements. I went through some blogs and found that ViewState is cleared after some duration in SharePoint.

So I Found that 30 minutes by default and then SharePoint ViewState is cleared after.

Turns out that web application has a setting that can be controlled through PowerShell.

$web = Get-SPWebApplication "http://mywebapp..." $web.FormDigestSettings.TimeOut

This is by default 30 minutes and SharePoint Viewstate cache is cleared after

FormDigestSettings.TimeOut +1 (i.e. 31 minutes)

$web.FormDigestSettings.TimeOut = New-TimeSpan -Hours 1 -Minutes 0
$webApp.Update()

Increasing this time out might have some performance implications.

Nice Article Please check this for details.

AppFabric Caching (and SharePoint): Configuration and Deployment (Part 2)

 

By Rijwan Ansari

MVP, CSM, CSPO, MCP, MCTS. Sr. Software Developer. Expertise in ASP.NET MVC, Angular, AngularJs, .Net Core, C#.NET, Azure, Cognitive Services, Machine Learning, SharePoint, Azure Services, and tools, Requirement Analysis, Team Management, Pre-Sales and more. Ability to work independently and Team, handle pressure and meet commitment. Excellence Communication and adjust in any environment

One thought on “ViewState in Web Part And Custom Page SharePoint”

Leave a Reply

Your email address will not be published. Required fields are marked *