473,671 Members | 2,570 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

clear OutputCache VaryByParam using code?

When displaying a database driven product page, I cache the page using:

<%@ OutputCache Duration="86400 " VaryByParam="Pr oductID" %>

which works fine UNLESS I change the pricing or description for that page in the
database.

Then, I need to clear the cache (either for that specific productID- or for the
aspx page and all the ProductID's it displays).

How can I clear the cache under program control?
--
Thanks in advance, Les Caudle
Nov 18 '05 #1
2 2931
Yes, I realize that - but that is not a good solution.

As the data on the page is tied to a database, I need a way to automatically
clear this cache when the database has changed.

By automatically, I mean using code, not modifying a page by hand in an editor -
or even changing the timestamp on the file (which requires certain permissions)

Somewhere inside of .NET, this cache lives - and there must be a way to clear
it..

Regards, Les Caudle

On Fri, 25 Jun 2004 08:50:10 -0700, "sunshine"
<su******@discu ssions.microsof t.com> wrote:
I don't know it this is a proper way to do it, but I found that when I alter the page and resave it (you can just type anything and undo it for the sake of saving), the cache starts from fresh again...

"Les Caudle" wrote:
When displaying a database driven product page, I cache the page using:

<%@ OutputCache Duration="86400 " VaryByParam="Pr oductID" %>

which works fine UNLESS I change the pricing or description for that page in the
database.

Then, I need to clear the cache (either for that specific productID- or for the
aspx page and all the ProductID's it displays).

How can I clear the cache under program control?
--
Thanks in advance, Les Caudle


Nov 18 '05 #2
What you're talking about is database dependency.... Asp.net does not support this natively unless your db is file based (it supports file dedendencies). But it can be done. Refer to: http://www.gotdotnet.com/team/rhoward/

"Les Caudle" wrote:
Yes, I realize that - but that is not a good solution.

As the data on the page is tied to a database, I need a way to automatically
clear this cache when the database has changed.

By automatically, I mean using code, not modifying a page by hand in an editor -
or even changing the timestamp on the file (which requires certain permissions)

Somewhere inside of .NET, this cache lives - and there must be a way to clear
it..

Regards, Les Caudle

On Fri, 25 Jun 2004 08:50:10 -0700, "sunshine"
<su******@discu ssions.microsof t.com> wrote:
I don't know it this is a proper way to do it, but I found that when I alter the page and resave it (you can just type anything and undo it for the sake of saving), the cache starts from fresh again...

"Les Caudle" wrote:
When displaying a database driven product page, I cache the page using:

<%@ OutputCache Duration="86400 " VaryByParam="Pr oductID" %>

which works fine UNLESS I change the pricing or description for that page in the
database.

Then, I need to clear the cache (either for that specific productID- or for the
aspx page and all the ProductID's it displays).

How can I clear the cache under program control?
--
Thanks in advance, Les Caudle


Nov 18 '05 #3

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

Similar topics

3
2265
by: marshal | last post by:
Hi to All, I am using <% @ OutputCache Duration="60" VaryByParam="none" %> in my usercontrol say "myControl.ascx". This user control has a property say "title". Now am Dynamically Loading this control in "myPage.aspx" like this
6
2735
by: Tom Kiefer | last post by:
Question: If I have an ASP.NET User Control which defines/exposes a property that the page can use to specify a mode or data subset for the control to use, is there a way to tell the @OutputCache directive to vary its cache based on that property value? I.e., I have: <my:control runat="server" id="mcOne" Flag="One" /> <my:control runat="server" id="mcTwo" Flag="Two" />
0
295
by: Vassilis T. via .NET 247 | last post by:
The following piece of code, when on a heavily loaded server (more than 50 ASP.NET pages, most using outputcache with varybyparam, lots of users), will only cache the string - the output is not cached, as if the outputcache is ignored. There is available RAM on the server. Other pages are cached as expected. On the development environment and on a test server, it works fine. Are there any limitations to the .NET caching, apart from RAM...
5
4631
by: z. f. | last post by:
sorry about the previous post, by mistake not completed. i have an asp.net page with the line <%@ OutputCache Duration="30" VaryByParam="none" %> but when i make requests to the page with different parameters, i get different result, but i tries to check if i set the VaryByParam to none there should be the same output for different parameters, so why does it not work?
1
2090
by: Sudhir Sharma | last post by:
guys, I have this code in my .aspx file. <%@ OutputCache Duration="500" VaryByCustom="OrganizationID" VaryByParam="None" %> and I have overriden the method "GetVaryByCustonString()" in my global.asax.cs file. whenever the organization is changed for the Page, it should invalidate the Cache and show the new information based on the organization. it is not doing that. I put the breakpoints in the code.It is hitting the...
1
1267
by: Amil Hanish | last post by:
I had an aspx page with output caching turned on. Then I wanted to do some other stuff and I commented it out like: <!-- <%@ OutputCache Duration="1800" VaryByParam="t" %> --> The IDE correctly shows this as a green comment...but don't be fooled. .NET still processes and caches the output. In my case, the ClientID values started being duplicated for a DataList object.
5
2156
by: Arpan | last post by:
I am using the following code to cache the page output for 60 seconds: <%@ OutputCache Duration="60" VaryByParam="*" %> <script runat="server"> Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) lblOutput.Text = "Welcome, " & Request.Params("id") & " The time now is " & DateTime.Now.ToString("T") End Sub </script>
3
3001
by: craigkenisston | last post by:
Hi, I have some controls with these: <%@ OutputCache Duration="500" Shared="true" VaryByParam="None" %> However, I need that under certain user action, specifically, changing a value on a dropdownlist with auto-postback, the cache for the control be cleaned and the content regenerated. Is there a way to do this ?
1
4869
by: Nalaka | last post by:
I had ..... <%@ OutputCache Duration="5000" Location="Server" VaryByParam="none" %> Then I added "browser" <%@ OutputCache Duration="5000" Location="Server" VaryByParam="none" VaryByCustom="browser" %> After I added browser... it stopped caching pages.... is there an explanation or... did I observe the problem wrong?
0
8930
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8677
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7446
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6238
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5704
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4417
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
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 we have to send another system
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.