Caching Web UserControl by Propety is not working (Grr!)

Posted by PapillonUK on Stack Overflow See other posts from Stack Overflow or by PapillonUK
Published on 2010-05-11T13:25:45Z Indexed on 2010/05/11 15:24 UTC
Read the original article Hit count: 244

Here's my code behind:

<PartialCaching(60, Nothing, "UsrCtl_WebUserControl.CacheString", Nothing, True)> _
Partial Class UsrCtl_WebUserControl
 Inherits System.Web.UI.UserControl

 Private _CacheString As String

 Public Property CacheString() As String
  Get
   Return _CacheString
  End Get
  Set(ByVal value As String)
   _CacheString = value
  End Set
 End Property
End Class

Here's the user control embedded in a page:

<uc:wuc ID="wuc" runat="server" CacheString="A" />

And in another page:

<uc:wuc ID="wuc" runat="server" CacheString="B" />

According to the docs this control should maintain a different, 60 second cached version for each value of the CacheString property.

It doesn't work - it caches for 60 seconds, but only one cached copy is created regardless of what I put in the CacheString property.

Anyone any ideas what i'm doing wrong? - After 4 hours of this I have no hair or nails left - please save my monitor from the brick.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about outputcache