Limit ASP.NET View State Caching
NCache provides flexibility to limit the number of ASP.NET View States per group and session and allows locking of the View State metadata. By configuring the ncContentOptimization tag, users can control the View State capacity per session, manage metadata synchronization through Metadata Locking, and define automated lock release intervals to prevent resource contention.
configure the following attributes in the <settings> element under <ncContentOptimization>:
<ncContentOptimization>
<settings enableViewstateCaching="true"
viewstateThreshold="0"
cacheUriMapping="true"
enableTrace="true"
groupedViewStateWithSessions="true"
maxViewStatesPerSession="5"
enableMetadataLocking="false"
releaseLockInterval="5000">
<cacheSettings cacheName="defaultCache">
<expiration type="None" duration="0" >
</cacheSettings>
</settings>
</ncContentOptimization>
ASP.NET View State Caching Configuration Members
Following are the ASP.NET View State caching configuration members:
| Members | Description |
|---|---|
maxViewStatesPerSession |
To enable this feature, specify a value greater than zero. If zero or a lower value is configured, all View States are cached. If the attribute is omitted, all View States are cached. |
enableMetadataLocking |
Defines whether internal metadata manipulation is a locking operation or not. It comes into play if maxViewStatesPerSession is enabled. Its default value is True. |
releaseLockInterval |
Defines the interval, in milliseconds, after which the lock is released. This setting applies when maxViewStatesPerSession is enabled. Its default value is 5000 milliseconds |
See Also
Configuring and Using NCache Content Optimization
Group View State with Session
Page Level Grouping for ASP.NET View State
Distributed Cache for ASP.NET Output Caching
ASP.NET SignalR Backplane Overview