Group ASP.NET View State with Session
NCache provides a feature that allows one to group ASP.NET View State with a particular session. Due to this dependency, as the session is expired, the View State associated with it expires too. The View State and session can reside either on two different c
<ncContentOptimization>
<settings enableMinification="false"
enableViewstateCaching="true"
groupedViewStateWithSessions="true"
viewstateThreshold="1"
cacheUriMapping="true"
enableTrace="true"
expireViewstateWithSession="true"
sessionCacheName="demoSessionCache"
sessionAppId="demoApp">
<cacheSettings cacheName="demoCache">
<expiration type="None" duration="0" >
</cacheSettings>
</settings>
</ncContentOptimization>
Group ASP.NET View State with Session Configuration Members
Following is the grouping for ASP.NET View State with Session Configuration Members.
Member | Description |
---|---|
groupedViewStateWithSessions |
Through this property a session can be grouped with ASP.NET View State. All the View States for a session are grouped with sessionId . This allows to retrieval of all View States grouped with a sessionId from the cache with group information. Set this property to "True" to enable View State grouping with sessions, it's False by default. |
expireViewstateWithSession |
Setting this property to True will ensure that when a session expires, its associated View State expires too. |
sessionAppId |
Specifies an identifier to ensure that sessionId remains unique in case multiple applications use the same cache. Its value should be the same as the sessionAppId in the sessionState tag. |
sessionCacheName |
The name of the cache on which the session data resides. Its value should be the same as the cacheName property in the session state tag. |
See Also
Configuring and Using NCache Content Optimization
Limit View State Caching
Page Level Grouping for View State
Distributed Cache for ASP.NET Output Caching
ASP.NET SignalR Backplane Overview