Mobile Caching Problems

Discussion in 'ASP .Net Mobile' started by Alex Maghen, Jan 6, 2007.

  1. Alex Maghen

    Alex Maghen Guest

    Hi. I'm trying to develop a simple Web Application for Mobile. It's just one
    page which will present dynamic data. The page will never be the same twice.
    But I try as I may, I don't seem to be able to stop the browser from Caching
    the page so that it doesn't re-load it each time.

    I've tried things like puting the following in the web.config:
    <system.web>
    <caching>
    <outputCache enableOutputCache="false"
    enableFragmentCache="false"
    sendCacheControlHeader="false"
    omitVaryStar="false">
    </outputCache>
    </caching>

    but that didn't help. What I don't understand is this: When I go to other
    sites on my phone (google, etc.), they always seem refreshed and new. How do
    I make my application do the same thing?

    Alex
    Alex Maghen, Jan 6, 2007
    #1
    1. Advertising

  2. Hello Alex,

    For browser cache, it generally use the http headers cache info to control
    the cache behavior. This has nothing to do with the ASP.NET server-side
    control setting. You can find some reference describe on the http cache
    header:

    #5.4.15 Cache Headers
    http://www.w3.org/TR/2006/CR-mobile-bp-20060627/#iddiv3123553312

    #Caching Tutorial
    http://www.mnot.net/cache_docs/

    And some thread discussing on programmatically disable client cache:

    http://forums.asp.net/thread/1519897.aspx

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead



    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Jan 8, 2007
    #2
    1. Advertising

  3. Alex Maghen

    Alex Maghen Guest

    Thanks for these. Another question though - is there a way that I can
    implement all of this non-chaching stuff globally for the whole application
    so that I don't have to do it on each page?

    "Steven Cheng[MSFT]" wrote:

    > Hello Alex,
    >
    > For browser cache, it generally use the http headers cache info to control
    > the cache behavior. This has nothing to do with the ASP.NET server-side
    > control setting. You can find some reference describe on the http cache
    > header:
    >
    > #5.4.15 Cache Headers
    > http://www.w3.org/TR/2006/CR-mobile-bp-20060627/#iddiv3123553312
    >
    > #Caching Tutorial
    > http://www.mnot.net/cache_docs/
    >
    > And some thread discussing on programmatically disable client cache:
    >
    > http://forums.asp.net/thread/1519897.aspx
    >
    > Sincerely,
    >
    > Steven Cheng
    >
    > Microsoft MSDN Online Support Lead
    >
    >
    >
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >
    Alex Maghen, Jan 8, 2007
    #3
  4. Thanks for your followup Alex,

    Sure, in ASP.NET application, we have the chance to customize the response
    of each page(or handler) request globally. That is using the
    httpmodule(developing a custom httpmodule). In ASP.NET, each request will
    go through a series of httpmodules, you can check the <httpmodules> section
    in machine.config or global web.config(in framework folder). Here are some
    article that help explain the role & events of httpmodule in ASP.NET
    request processing:

    http://www.theserverside.net/tt/articles/showarticle.tss?id=IIS_ASP

    http://msdn2.microsoft.com/en-us/library/ms178473.aspx

    for your scenario, you can create a custom httpmodule and hook one of the
    events you can attach in httpmodule. In the event handler, you can check
    the current request(check content type or request URL or any other
    properties you can get from HttpContext.Current...) and determine whether
    this is a request you want to disable the cache of its response. If so, you
    can customize the client-side http cache related headers.

    Here are some knowledge base articles about creating custom httpmodule:

    http://support.microsoft.com/kb/307996/en-us

    http://support.microsoft.com/kb/307985/en-us

    Hope these also helps.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead



    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Jan 9, 2007
    #4
  5. Hi Alex,

    Thanks for the followup.

    Sure, using master page is possible as long as your pages will use a shared
    master page.

    For the problem that the page still be cached. I think you can first test
    the page in a normal PC browser (IE or FF) to see whether it is also
    cached. If also cached on PC browser, that means we haven't configure the
    page's response cache header correctly. Elsewise, this may be specific to
    the device as you said. And for such case, I think you may use some trace
    tools to capture the http response message from those pages which are not
    cached and your own pages. Compare the response http mesage and headers to
    see what's the significant difference.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Jan 10, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hypo
    Replies:
    6
    Views:
    407
  2. Troy Simpson

    Fragment Caching inside page caching?

    Troy Simpson, Jan 19, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    785
    Troy Simpson
    Jan 19, 2004
  3. Zahoor
    Replies:
    1
    Views:
    805
    Darryl L. Pierce
    Nov 15, 2003
  4. JimLad
    Replies:
    3
    Views:
    913
    JimLad
    Jan 21, 2010
  5. chen selina
    Replies:
    0
    Views:
    1,294
    chen selina
    Jul 13, 2010
Loading...

Share This Page