dcsimg
www.webdeveloper.com
Results 1 to 5 of 5

Thread: caching ASP pages

  1. #1
    Join Date
    May 2003
    Location
    Mordor
    Posts
    454

    caching ASP pages

    Hi Guys,

    I'm trying control the caching on ASP generated pages as a number of pages my app generates never change (in fact they are filled with javascript as this provides a neat way to bundle the js code with the application dll)

    anyway, I have set the cachecontrol on the response (equivalent to going Response.CacheControl = "Public") but I am noticing that the server is handling these pages over and over even though the url for these pages is still the same.

    It's as if these pages aren't being cached and the browser is going back to the server each time. I've tried with both IE and Netscape with the same results.

    Strangely, when I look in the Temporary Internet Files folder (for IE) the pages are there.

    Am I missing something? How can I have these pages cached?

  2. #2
    Join Date
    Jan 2003
    Location
    USA
    Posts
    688
    Here is what I put at the top of my database-related ASP pages to prevent caching:

    <%
    Response.Expires = -1000
    %>

  3. #3
    Join Date
    May 2003
    Location
    Mordor
    Posts
    454
    But I want these pages to be cached. Is this sensible or am I barking up the wrong tree?

  4. #4
    Join Date
    Jan 2003
    Location
    USA
    Posts
    688
    My understanding is that without something like Response.Expires = -1000 or something similar that the pages would be allowed to be cached by the user's browser if his browser settings allow this.

    In IE Tools | Internet Options | General tab | Settings button | Check for newer versions of stored pages...

  5. #5
    Join Date
    May 2003
    Location
    Mordor
    Posts
    454
    AHA!

    I've added a bit that says...

    Response.Expires = <some day a year from now>

    and this gives me the behaviour I was after.

    Without it, it seems the browser goes back to the server every page (except when you tell it to never look). With it, the browser can compare the date with it's version of now and decide whether to download it again.

    Thanks Bullschmidt

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles