Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Caching / January 2004

Tip: Looking for answers? Try searching our database.

Adding cookie resets cache

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeff Marken - 23 Jan 2004 01:04 GMT
Here's my cache directive:

<%@ OutputCache Duration="3600" VaryByParam="none"
VaryByCustom="IndexPage" Location="Server" %>

I added a simple time stamp to the page so I could see it working.

Caching works fine when not adding cookies.  I can go to different
machines and open and close browsers and the timestamp remains the
same, verifying that caching is working.

Now, when I add a cookie to the response, the cache resets itself, but
only after I close the browser, or when I go to a different machine
and hit the page.

Any ideas?  Is this by design?

I frequently add cookies to the response, often enough so that if this
is by design, caching will be of little use.

Thanks,

Jeff
Jeff Marken - 25 Jan 2004 20:42 GMT
Folks,

I have played around with this a lot more, and have the same problem,
but know what it is, so can refine my question.  I need a way to get
around this problem...

I cache a heavily accessed ASPX page.  It's sortable in several ways,
and when the user clicks a sorting link, a query string parameter is
used to specify the sort key.  I use cookies to remember the sort key
so that the user can go elsewhere on or off the site and return to
this page and the sort preference will be retained.

When the user clicks a different sorting key, the server sees the key
in the URL and uses it to return the cached version of that page if
applicable, but when it does, since the cached page is returned, the
cookie for the new sorting key is not returned.  I tried adding the
cookie to cookies collection in the request object when
'GetVaryByCustomString' is invoked, but the cookie doesn't actually
make it out of the server if it finds the page in cache.

How can I force the cookie to go out even if a cached page is actually
returned?  Is there some other method I can override to do this?  Do I
need to use an HttpModule or HttpHandler to set the cookies, and if
so, will this interefere with the caching mechanis an ASP.NET?

Any help would be appreciated!

Jeff

> Here's my cache directive:
>
[quoted text clipped - 19 lines]
>
> Jeff

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.