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
Increasing this time out might have some performance implications.
Nice Article Please check this for details.