Thread: ASP.NET/enable output caching in ASP.NET

enable output caching in ASP.NET


Solution: enable output caching in ASP.NET

You cannot add an OutputCache directive on a master page. You must do the caching instructions programmatically, in code. Every content page that uses the master page needs output caching enabled.

protected void Page_Load(object sender, EventArgs e)


    // Use DateTime for expiration.



    // HttpCacheability.Server means that the page will only be created once

    // on the server. Private means that the client is also allowed to cache.



    // Indicate that the client's cache is valid until the item expires.



Re: enable output caching in ASP.NET