locked
How to access/clear page cache via Javscript ? RRS feed

  • Question

  • User-79977429 posted

    Hi

    i'm using this code to save my data inside Page.Cache object :

    this.Cache["_cacheData"] = myDataTable;

    However, I want to access/clear this object via javscript code.

    Can anybody help me how to accomplish this task ?

    Thanks in advance

    Thursday, September 26, 2019 10:45 AM

Answers

  • User475983607 posted

    Page cache exists on the server.  You'll need to make a HTTP request to clear the cache.  This can be accomplished using jQuery AJAX by invoking a Web Form that clears the page cache.

    $.get( "/path/to/the/file.aspx", function( data ) {
      console.log(data);//page results for debugging
    });

    Then simply clear the cache in your aspx page.  Perhaps in the Page_Load event.

    this.Cache["_cacheData"] = null;

    https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.page.cache?view=netframework-4.8

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 26, 2019 11:17 AM