This example demonstrates how to use LocationInterceptionAspect to persist a field or property in the ASP.NET session state or page view state.
The
SessionStateAttributeclass is a Aspect that persists a field or property into the session state. This attribute can be added to any field or property. This aspect is a simple implementation ofLocationInterceptionAspect.The
ViewStateAttributeclass is a Aspect that persists a field or property into the view state of the current page. This attribute should be added to an instance field or property of a type derived fromSystem.Web.UI.Control. TheViewStateAttributeaspect is more complex because it needs to access theViewStateproperty, a protected property of theControlclass. Therefore, we have to use the[ImportMember]advice and theIInstanceScopedAspectinterface.