* HOW to the OutputCache

Last post 11-25-2006 12:25 PM by waynelambright. 2 replies.

Sort Posts:

  • * HOW to the OutputCache

    11-23-2006, 12:15 PM
    • Loading...
    • waynelambright
    • Joined on 05-23-2006, 11:26 PM
    • San Francisco
    • Posts 20

    Hello,

    I am trying to dump the cache on my home page.  that when I pass a value w=1

    but it's not working any ideas? 

     

    <%@ Page Language="VB"  Debug="true"  ContentType="text/html" ResponseEncoding="iso-8859-1" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.SqlClient" %>
    <%@ OutputCache Duration="3600" Location="Server"  VaryByParam="none" %>

    <%

    if request.QueryString("w")="1" then

        Dim path As String
        path="/default.aspx"
        HttpResponse.RemoveOutputCacheItem(path)
     
    end if

    %>
     

     

     

    Wayne Lambright
    http://lambright.com
    415-750-1921 GMT-8 Pacific
    Filed under: ,
  • Re: * HOW to the OutputCache

    11-25-2006, 9:48 AM
    Answer
    • Loading...
    • joteke
    • Joined on 06-16-2002, 3:24 PM
    • Kyro, Finland
    • Posts 6,568
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    Hi,

    you can use Response.Cache.AddValidationCallBack See: http://www.hanselman.com/blog/AdvancedASPNETCachingAndAddValidationCallBack.aspx

    You can also use RemoveOutputCacheItem but it must get absolute virtual path, plus you must ensure that the code runs (it won't run on the same page when page is in output cache) e.g run on different place (say in global.asax's events or this Validation callback). More information about remove techniques: http://aspalliance.com/668

    Thanks,

    Teemu Keiski
    Finland, EU
  • Re: * HOW to the OutputCache

    11-25-2006, 12:25 PM
    • Loading...
    • waynelambright
    • Joined on 05-23-2006, 11:26 PM
    • San Francisco
    • Posts 20

    Thanks for the help.

    you answered my question.  this was the key hangup.

    (plus you must ensure that the code runs (it won't run on the same page when page is in output cache))

     
    I was running the code on the page that had the outputcache.

    thanks for your help.


     

    Wayne Lambright
    http://lambright.com
    415-750-1921 GMT-8 Pacific
    Filed under:
Page 1 of 1 (3 items)
Microsoft Communities
Page view counter