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 / March 2005

Tip: Looking for answers? Try searching our database.

OutputCache Shared=True not working as expected

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
curtis_mcmillin - 16 Mar 2005 00:53 GMT
I have several ASP.NET web pages, on which I place a user control with
caching enabled.  I would like to share the cached version of this control
across all pages on which the control resides, but, vary it by a property in
the user control.  So, my user control @Cache directive looks like this:

<%@ OutputCache Duration="600" Shared="true" VaryByControl="SelectedItem" %>

...where 'SelectedItem' the name of the public property on the user control.

The control is indeed being cached, as is evidenced by the breakpoint set in
the control load event.  It fires only once, however, which I would not
expect.  My expectation is that a seperate copy of the control's output would
be placed in the cache for each unique 'SelectedItem' value.

Has anyone ran across this?  Any and all help/suggestions would be greatly
appreciated.

-Curtis McMillin, MCSD
curtis_mcmillin@hotmail.com
curtis.mcmillin@conocophillips.com
Alvin Bruney [ASP.NET MVP] - 16 Mar 2005 19:57 GMT
The output cache directive is overriden at the page level. Do you have any
settings at the page level that may override the settings of the user
control?

Signature

Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________

>I have several ASP.NET web pages, on which I place a user control with
> caching enabled.  I would like to share the cached version of this control
[quoted text clipped - 21 lines]
> curtis_mcmillin@hotmail.com
> curtis.mcmillin@conocophillips.com
jawadak@gmail.com - 24 Mar 2005 21:46 GMT
Hi Curtis,
  If selectedItem property refers to a Value selected from the Drop
down that is placed in the User Control then you have to use the id of
the drop down in the output cache directive i.e.
<%@ OutputCache Duration="600" Shared="true"
VaryByControl="ddCountries"
%>

 Where ddCountries is the id of the dropdown whose selected value you
want to cache to differentiate from. The Public propert doesn't work
for me in the VaryByControl as well.

Thank you,
Jawad
> The output cache directive is overriden at the page level. Do you have any
> settings at the page level that may override the settings of the user

> control?
>
[quoted text clipped - 7 lines]
>
> "curtis_mcmillin" <curtismcmillin@discussions.microsoft.com> wrote in

> message news:5B323109-1ED2-421A-8700-60A41764794A@microsoft.com...
> >I have several ASP.NET web pages, on which I place a user control with
[quoted text clipped - 7 lines]
> >
> > ...where 'SelectedItem' the name of the public property on the user

> > control.
> >
[quoted text clipped - 11 lines]
> > curtis_mcmillin@hotmail.com
> > curtis.mcmillin@conocophillips.com

Rate this thread:







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.