Caching ascx control (2.0)
Caching ascx control (2.0)
am 23.01.2008 03:05:34 von Tomasz Jastrzebski
Hello Developers,
Is it possible to vary ascx control cache base on that control's public
property.
My control has a public Color property, and I want to vary cache based this
property, rather than any particular contained control or query parameter.
Thank you for any hints.
Tomasz J
RE: Caching ascx control (2.0)
am 23.01.2008 07:17:50 von stcheng
Hi Tomasz,
From your description, you'd like to cache an ascx userconttrol on your
page and also control the cache period through a certain property of the
control, correct?
So far based on my understanding, the usercontrol cache will support the
following cache conditions:
*VaryByCustom
*VaryByHeader
*VaryByParam
*VaryByControl
#@ OutputCache
http://msdn2.microsoft.com/en-us/library/hdxfb6cy(VS.71).asp x
#Caching Portions of an ASP.NET Page
http://msdn2.microsoft.com/en-us/library/h30h475z(VS.71).asp x
and for your scenario, I think you may consider store the Color property
into a certain control's property and set that control via the
"VaryByControl" condition. How do you think?
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/de fault.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx .
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Tomasz J"
>Subject: Caching ascx control (2.0)
>Date: Wed, 23 Jan 2008 03:05:34 +0100
>
>Hello Developers,
>
>Is it possible to vary ascx control cache base on that control's public
>property.
>My control has a public Color property, and I want to vary cache based
this
>property, rather than any particular contained control or query parameter.
>Thank you for any hints.
>
>Tomasz J
>
>
>
Re: Caching ascx control (2.0)
am 23.01.2008 12:19:04 von Tomasz Jastrzebski
Thanks,
Well, Color was just an example - not the best one, since many controls have
this property.
Let's say that my ascx control has one custom property:
public string MyCustomProperty {get; set;}
and it contains Literal controls only.
I need to cache a different version of my control for every MyCustomProperty
value.
Tomasz
"Steven Cheng[MSFT]" wrote in message
news:7%23rl6eYXIHA.308@TK2MSFTNGHUB02.phx.gbl...
> Hi Tomasz,
>
> From your description, you'd like to cache an ascx userconttrol on your
> page and also control the cache period through a certain property of the
> control, correct?
>
> So far based on my understanding, the usercontrol cache will support the
> following cache conditions:
>
> *VaryByCustom
> *VaryByHeader
> *VaryByParam
> *VaryByControl
>
> #@ OutputCache
> http://msdn2.microsoft.com/en-us/library/hdxfb6cy(VS.71).asp x
>
> #Caching Portions of an ASP.NET Page
> http://msdn2.microsoft.com/en-us/library/h30h475z(VS.71).asp x
>
> and for your scenario, I think you may consider store the Color property
> into a certain control's property and set that control via the
> "VaryByControl" condition. How do you think?
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
>
> ==================================================
>
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/de fault.aspx#notif
> ications.
>
>
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscriptions/support/default.aspx .
>
> ==================================================
>
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
> --------------------
>>From: "Tomasz J"
>>Subject: Caching ascx control (2.0)
>>Date: Wed, 23 Jan 2008 03:05:34 +0100
>>
>>Hello Developers,
>>
>>Is it possible to vary ascx control cache base on that control's public
>>property.
>>My control has a public Color property, and I want to vary cache based
> this
>>property, rather than any particular contained control or query parameter.
>>Thank you for any hints.
>>
>>Tomasz J
>>
>>
>>
>
Re: Caching ascx control (2.0)
am 24.01.2008 04:00:28 von stcheng
Thanks for your reply Tomasz,
Yes, the property on which you want to cache depend may vary, however,
since you'd like to adopt the built-in cache feature, you may try mappijng
your property value to one of those possible cache parameters(http get/get
value, Control property, ....).
Originally, I've thought about two means:
1. use an additional hidden TextBox control in the usercontrol(which
contains your certain custom property value) so that cache can rely on it.
2. You can programmatically use code to add some flag(your custom control's
value into cookie) and use the "VaryByCustom" option to programmatically
read cookie collection to determine how to cache, here is a article about
this:
http://codebetter.com/blogs/darrell.norton/archive/2004/05/0 4/12724.aspx
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Tomasz J"
>References:
<7#rl6eYXIHA.308@TK2MSFTNGHUB02.phx.gbl>
>Subject: Re: Caching ascx control (2.0)
>Date: Wed, 23 Jan 2008 12:19:04 +0100
>
>Thanks,
>
>Well, Color was just an example - not the best one, since many controls
have
>this property.
>Let's say that my ascx control has one custom property:
>
>public string MyCustomProperty {get; set;}
>
>and it contains Literal controls only.
>
>I need to cache a different version of my control for every
MyCustomProperty
>value.
>
>Tomasz
>
>
>"Steven Cheng[MSFT]" wrote in message
>news:7%23rl6eYXIHA.308@TK2MSFTNGHUB02.phx.gbl...
>> Hi Tomasz,
>>
>> From your description, you'd like to cache an ascx userconttrol on your
>> page and also control the cache period through a certain property of the
>> control, correct?
>>
>> So far based on my understanding, the usercontrol cache will support the
>> following cache conditions:
>>
>> *VaryByCustom
>> *VaryByHeader
>> *VaryByParam
>> *VaryByControl
>>
>> #@ OutputCache
>> http://msdn2.microsoft.com/en-us/library/hdxfb6cy(VS.71).asp x
>>
>> #Caching Portions of an ASP.NET Page
>> http://msdn2.microsoft.com/en-us/library/h30h475z(VS.71).asp x
>>
>> and for your scenario, I think you may consider store the Color property
>> into a certain control's property and set that control via the
>> "VaryByControl" condition. How do you think?
>>
>> Sincerely,
>>
>> Steven Cheng
>>
>> Microsoft MSDN Online Support Lead
>>
>>
>>
>> ==================================================
>>
>> Get notification to my posts through email? Please refer to
>>
http://msdn.microsoft.com/subscriptions/managednewsgroups/de fault.aspx#notif
>> ications.
>>
>>
>>
>> Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
>> where an initial response from the community or a Microsoft Support
>> Engineer within 1 business day is acceptable. Please note that each
follow
>> up response may take approximately 2 business days as the support
>> professional working with you may need further investigation to reach the
>> most efficient resolution. The offering is not appropriate for situations
>> that require urgent, real-time or phone-based interactions or complex
>> project analysis and dump analysis issues. Issues of this nature are best
>> handled working with a dedicated Microsoft Support Engineer by contacting
>> Microsoft Customer Support Services (CSS) at
>> http://msdn.microsoft.com/subscriptions/support/default.aspx .
>>
>> ==================================================
>>
>>
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>>
>> --------------------
>>>From: "Tomasz J"
>>>Subject: Caching ascx control (2.0)
>>>Date: Wed, 23 Jan 2008 03:05:34 +0100
>>>
>>>Hello Developers,
>>>
>>>Is it possible to vary ascx control cache base on that control's public
>>>property.
>>>My control has a public Color property, and I want to vary cache based
>> this
>>>property, rather than any particular contained control or query
parameter.
>>>Thank you for any hints.
>>>
>>>Tomasz J
>>>
>>>
>>>
>>
>
>
>