Specify the Cache Location - OutputCache directive

Q.  How will you specifying the Cache Location?
- Published on 16 Jun 15

a. You can use browser settings to specify where a page is cached.
b. You can use the Location attribute of the < %@ OutputCache %> directive to specify where a page is cached.
c. You can use the Location attribute in QueryString to specify where a page is cached.
d. None of the above.

ANSWER: You can use the Location attribute of the < %@ OutputCache %> directive to specify where a page is cached.
 
By default, when you use Page Output Caching, a page is cached in three locations: web server, any proxy servers, and browser. You can write following code to cache the page on server for 50 seconds.

< %@ OutputCache Duration="50" VaryByParam="none" Location=”Server” %>

Post your comment / Share knowledge


Enter the code shown above:
 
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)