Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to force a reload of cached user control?

Reply
Thread Tools

How to force a reload of cached user control?

 
 
Edward Chung
Guest
Posts: n/a
 
      02-13-2005
I create a user control that is used as a page header for all
application's pages. The user control contains a HyperLink control named
accountHyperlink whose text can either set to "Account/Logon" or
"Account/Logout" depending on whether the user is logged on. I want to cache
this user control for 1 hour but have it automatically reloaded if the
accountHyperlink.Text is changed. So I place the following line of code on
its ascx page:

<% @OutputCache%@ OutputCache Duration="3600" VaryByParam="none"
VaryByControl="accountHyperlink" %>

The user control is not refreshed on other pages that use it after the
accountHyperlink.Text changed. So do I use incorrect codes for my purpose or
do I need to place more codes (somewhere) to force the user control to
reload to reflect the change?



 
Reply With Quote
 
 
 
 
Steve Lutz
Guest
Posts: n/a
 
      02-13-2005
Edward,
Is it possible to just have the item change it's text based on the logged in
status of the user? By using a cache, you are leaving a lot of work to
unknown possibilities. The cache could be overwritten because it ran out of
space and needed the cache room for something else. Also, the cache could be
reset elsewhere, either in code, or by an application restart. Generally, I
only use the cache for storing items that I can 1) always recreate and 2) do
not care about the state of the cached entry.
If you cannot recreate the control, then what happens when the cache
expires? It COULD expire before the 3600 minutes remember.

HTH

Steve


"Edward Chung" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I create a user control that is used as a page header for all
> application's pages. The user control contains a HyperLink control named
> accountHyperlink whose text can either set to "Account/Logon" or
> "Account/Logout" depending on whether the user is logged on. I want to

cache
> this user control for 1 hour but have it automatically reloaded if the
> accountHyperlink.Text is changed. So I place the following line of code on
> its ascx page:
>
> <% @OutputCache%@ OutputCache Duration="3600" VaryByParam="none"
> VaryByControl="accountHyperlink" %>
>
> The user control is not refreshed on other pages that use it after the
> accountHyperlink.Text changed. So do I use incorrect codes for my purpose

or
> do I need to place more codes (somewhere) to force the user control to
> reload to reflect the change?
>
>
>



 
Reply With Quote
 
 
 
 
Aquila Deus
Guest
Posts: n/a
 
      02-13-2005
Edward Chung wrote:
> I create a user control that is used as a page header for all
> application's pages. The user control contains a HyperLink control

named
> accountHyperlink whose text can either set to "Account/Logon" or
> "Account/Logout" depending on whether the user is logged on. I want

to cache
> this user control for 1 hour but have it automatically reloaded if

the
> accountHyperlink.Text is changed. So I place the following line of

code on
> its ascx page:
>
> <% @OutputCache%@ OutputCache Duration="3600" VaryByParam="none"
> VaryByControl="accountHyperlink" %>
>
> The user control is not refreshed on other pages that use it after

the
> accountHyperlink.Text changed. So do I use incorrect codes for my

purpose or
> do I need to place more codes (somewhere) to force the user control

to
> reload to reflect the change?


http://www.dotnet247.com/247referenc.../11/59941.aspx

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nike air force one, air force 1, air force one low cut, air force one abdul_razak@indiatimes.com Digital Photography 2 12-31-2008 04:29 PM
Nike Air Force Ones,Air Force One Air Force One-1 lky52193@gmail.com Computer Support 0 01-17-2008 04:40 PM
Nike Air Force Ones,Air Force One Air Force One-1,25th anniversary lky52112@gmail.com Digital Photography 0 01-15-2008 04:46 PM
Nike Air Force Ones,Air Force One Air Force One-1,25th anniversary lky52112@gmail.com Digital Photography 0 01-15-2008 04:34 PM
my cached dataset just wont stay cached!! Craig G ASP .Net 0 03-07-2005 10:02 AM



Advertisments