Monday, March 26, 2012

Newbie: Page level caching in ASP.NET

Hi,
How could Page level caching be implemented in ASP.NET ? My ASP.NET page
takes some query arguments and I want page level cache to last for the
lifetime of the page generated using the passed arguments only. If different
arguments are passed, I want new page level cache for the new page. Is it as
simple as adding page level variables ? Note page may query data
asynchronously using AJAX also. Does it change things ?
Thanks and regards
NavinAjax shouldn't screw around with anything.
To cache different versions based on querystring values, use the VaryByParam
attribute of the OutputCache control
<%@. OutputCache Duration="3600" VaryByParam="id" %>
assuming "id" is the querystring you want to create a different cache on.
Take a look at:
http://samples.gotdotnet.com/quicks...putcaching.aspx
Karl
MY ASP.Net tutorials
http://www.openmymind.net/
"Navin Mishra" <navin.mishra@.siemens.com> wrote in message
news:uQ6LgmEAGHA.916@.TK2MSFTNGP10.phx.gbl...
> Hi,
> How could Page level caching be implemented in ASP.NET ? My ASP.NET page
> takes some query arguments and I want page level cache to last for the
> lifetime of the page generated using the passed arguments only. If
> different
> arguments are passed, I want new page level cache for the new page. Is it
> as
> simple as adding page level variables ? Note page may query data
> asynchronously using AJAX also. Does it change things ?
> Thanks and regards
> Navin
>
Thanks. My qyery string is long passing a bunch of arguments. Would it work
for a combination of query string arguments ? Is there a limit ? I also
wanted simple caching while generated page is active and, to use the cache,
when an action is performed on the page. When page is destroyed, I want to
clear THAT page level cache. Would simple page level variables do that are
garbage collected when Page object is destroyed after ASP.NET page request
completes ?
Thanks again and regards
"Karl Seguin" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:uwpW89EAGHA.1256@.TK2MSFTNGP15.phx.gbl...
> Ajax shouldn't screw around with anything.
> To cache different versions based on querystring values, use the
VaryByParam
> attribute of the OutputCache control
> <%@. OutputCache Duration="3600" VaryByParam="id" %>
> assuming "id" is the querystring you want to create a different cache on.
> Take a look at:
> http://samples.gotdotnet.com/quicks...putcaching.aspx
> Karl
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
> "Navin Mishra" <navin.mishra@.siemens.com> wrote in message
> news:uQ6LgmEAGHA.916@.TK2MSFTNGP10.phx.gbl...
page
it
>
Comments appreciated! Is it possible ?
Thanks in advance and regards
"Navin Mishra" <navin.mishra@.siemens.com> wrote in message
news:%231jq8DLAGHA.3984@.TK2MSFTNGP14.phx.gbl...
> Thanks. My qyery string is long passing a bunch of arguments. Would it
work
> for a combination of query string arguments ? Is there a limit ? I also
> wanted simple caching while generated page is active and, to use the
cache,
> when an action is performed on the page. When page is destroyed, I want to
> clear THAT page level cache. Would simple page level variables do that are
> garbage collected when Page object is destroyed after ASP.NET page request
> completes ?
> Thanks again and regards
> "Karl Seguin" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net>
> wrote in message news:uwpW89EAGHA.1256@.TK2MSFTNGP15.phx.gbl...
> VaryByParam
on.
> page
> it
>

0 comments:

Post a Comment