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

Research and Technology Lead | Software Architect | Full Stack .NET Expert | Tech Blogger | Community Speaker | Trainer | YouTuber. Follow me @ https://rijsat.com Md Rijwan Ansari is a high performing and technology consultant with 10 plus years of Software Development and Business Applications implementation using .NET Technologies, SharePoint, Power Platform, Data, AI, Azure and cognitive services. He is also a Microsoft Certified Trainer, C# Corner MVP, Microsoft Certified Data Analyst Associate, Microsoft Certified Azure Data Scientist Associate, CSM, CSPO, MCTS, MCP, with 15+ Microsoft Certifications. He is a research and technology lead in Tech One Global as well as leading Facebook community Cloud Experts Group and SharePoint User Group Nepal. He is a active contributor and speaker in c-sharpcorner.com community, C# Corner MVP and his rank at 20 among 3+ millions members. Additionally, he is knee to learn new technologies, write articles, love to contribute to the open-source community. Visit his blog RIJSAT.COM for extensive articles, courses, news, videos and issues resolution specially for developer and data engineer.

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 *