Cache ASP.NET pages on the client in 2 steps

Learn Web Stimulus Caching

If you have already accelerated your web page back-end performance in 3 steps, but need even more speed, enable dynamic client caching with your own caching rule in 2 steps as shown on this page.

Screenshot Tutorials

Learn Front-End Acceleration. See how to enable Main Accelerate on entire site in 3 steps with zero coding.

Learn Web Stimulus Back-End Acceleration. See how to accelerate web forms in 3 steps without coding.

Step 1: Define Cache Key and invalidation variable.

  • Click on Web Stimulus Data Packet control.
  • Type an expression that represents the cache key in its Property window in the CacheKey property (in this case it is Calendar1.SelectedDate).
  • To enable time-based caching, type in the desirable number of seconds in the Duration property ,  or
  • To disable time-based caching and use only custom caching set the Duration property to "-1."
  • Type the name of the Boolean variable that will be used to invalidate the cache in the property InvalidationVariable" (in this case it is sp500Invalid).
  • Define three property of Data Packet control.

    Define three properties of Data Packet control.

    Step 2: Define a custom invalidation rule.

  • In the Page class declare the Boolean Invalidation Variable used in the previous step.
  • Write code that sets the Invalidation Variable to True when you need to invalidate the cache according to your business rules.
  • Note 1: Server code can access the age of the cached data using the API call GetPacketLastModified().

    Note 2: The Web Stimulus API fully supports IntelliSense.

    Validate cache as easy as one Boolean variable.

    Validating the cache is as easy as one Boolean variable.

    With dynamic client caching you can be sure the web page always uses cached data when possible and never displays stale content.

    Watch the 5-minute step-by-step video demo of this example.

    See or download source code of the web page in this example.