Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 9th, 2004, 09:15 AM
Authorized User
 
Join Date: Mar 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default User control caching on a single page

I have a page (called default.aspx) containing the following directive to ensure that caching is disabled:
Code:
<%@ OutputCache Duration="30" Location="None" VaryByParam="None" %>
This page contains a user control (called navigation.ascx) that does not contain an OutputCache directive at all. This user control contains dynamic data retrieved from an XML document.

If I load default.aspx then change the navigation xml source. Then reload the page the user control (navigation.ascx) is loaded from cache. I can tell this because I'm writing the current time out in the Page_Load function and the contents doesn't change. This user control should not be cached because it does not contain a OutputCache page directive.

Another strange fact is that if I load another page that was not previously loaded (called feedback.aspx) the user control displays a fresh version (updated with a new date and data). The fresh version shows only on feedback.aspx and the old version still shows on default.aspx. If I change the navigation xml source again I now have 3 versions of the navigation (default.aspx version, fresh.aspx version, and source version).

It seems that the user control itself is not being cached, but the page is caching it's parts. Is this possible, or is it something else? How do I disable this so that I always get a fresh navigation even when the same page is reloaded?

 
Old June 9th, 2004, 09:54 AM
Authorized User
 
Join Date: Mar 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry for the inconvenience, but I've found my problem. It seems that it wasn't exactly as I described earlier. Instead of having the user control (navigation.ascx) included on the page (default.aspx) it was included on another user control (header.ascx). In other words the user control navigation.ascx was a part of the user control header.ascx which was a part of the page default.aspx. It was the intermediate user control header.ascx that had OutputCaching enabled and was causing my problems.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Master Page - User Control communication Aaron Edwards ASP.NET 2.0 Basics 8 March 7th, 2008 08:52 AM
User Control not rendering in Master Page skmcusp ASP.NET 2.0 Basics 2 September 10th, 2007 04:58 PM
How to Link User control Form to Home page Dhanapal ASP.NET 1.0 and 1.1 Basics 1 March 12th, 2007 05:30 PM
how to reference user control in master page.. gbianchi ASP.NET 2.0 Basics 1 May 1st, 2006 09:26 AM
Changing Page Title From User Control [email protected] ASP.NET 1.0 and 1.1 Professional 5 October 11th, 2005 08:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.