Mobile Caching Problems

A

Alex Maghen

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
 
S

Steven Cheng[MSFT]

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.
 
A

Alex Maghen

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?
 
S

Steven Cheng[MSFT]

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.
 
S

Steven Cheng[MSFT]

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top