1.

How can you cache different versions of the same page using the ASP.NET Cache object?

Answer»

OUTPUT cache FUNCTIONALITY is achieved using the OutputCache attribute in the ASP.NET page header. Below is the syntax:

<%@ OutputCache Duration="20" Location="Server" Vary By Param="state" Vary By Custom="minor version" Vary By Header="Accept-Language"%>
  • Vary By Param - Caches different versions DEPENDING on input parameters sent through HTTP POST/GET.
  • Vary By Header - Caches different versions depending on the contents of the page header.
  • Vary By Custom - LETS you customize the way the cache handles page variations by declaring the attribute and overriding the Get Vary By Custom string handler.
  • Vary By Control - Caches different versions of a user control based on the value of properties of ASP objects in the control.


Discussion

No Comment Found