473,513 Members | 2,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to force a reload of cached user control?

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?

Nov 19 '05 #1
2 4789
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" <ed******@3web.net> wrote in message
news:eQ**************@TK2MSFTNGP09.phx.gbl...
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?

Nov 19 '05 #2
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

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
42742
by: Martin | last post by:
This is probably more of an HTML question than PHP. Perhaps someone here can answer or point me to a proper newsgroup. How can I force the browser to reload an image from the server? I have a...
1
40007
by: Mike Gifford | last post by:
Hello, I'm right now using window.location.reload() to refresh the browser. It behaves as I would want in Mozilla/Netscape, but not in IE. I want to refresh a form, but keep the cached...
1
10837
by: Marco Maroni | last post by:
How to force image refresh on client browser ? Is ti possible to force the refresh of the same image (tha was changed server-side) to the client, without user press Contrl+F5 in IE ? - Marco
8
16988
by: Mats Lycken | last post by:
Hi, I'm working on a webproject where I have several different user controls loaded on a WebForm. A problem arises when I in one webcontrol makes a change that should be picked up by another user...
4
2534
by: Paul Drummond | last post by:
Is there a way to force a page refresh, so users will not receive a cached version of a page, even if they have their browser set to never check for a newer version of page? Thank you!
16
2547
by: janders | last post by:
Hey all, I've got a document that I want to ensure always get loaded into the top level document and not into a frame or iframe. I've got it figured out how to detect if the document is loaded...
0
1149
by: tshad | last post by:
I am having a problem with a page that loads a user control that absolutely must reload if there are errors on the page. But if you have IE set to never check for newer versions of the page, it...
1
429
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I force a reload from the server/prevent caching?...
3
2102
by: COHENMARVIN | last post by:
I have a button in my asp.net page (actually its in a user control with a .ASCX suffix) called btnGetData. I'm trying to make it force a refresh of my page. So what I did was make it call...
0
7175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7391
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7553
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5697
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3247
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3235
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1609
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.