General discussion



By coolmanohar ·
How to remove a cache variable on application close in

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by BFilmFan In reply to Caching

Explicit removal on an object from cache example below:

<script language=C# runat=server>
public void Application_OnStart()
System.IO.StreamReader sr =
new System.IO.StreamReader("pi.txt");
string pi = sr.ReadToEnd();
Context.Cache.Add("pi", pi, null,
new TimeSpan(0, 5, 0),
new CacheItemReomovedCallback(this.OnRemove));
public void OnRemove(string key, object val, CacheItemRemovedReason r)
// respond to cache removal here

Setting an absolute expiration for a page in the output cache example below:

<%@ OutputCache Duration="3600" VaryByParam="none" %>
<script language="C#" runat="server">
void Page_Load(Object sender, EventArgs e) {
msg.Text = DateTime.Now.ToString();
<h3>Output Cache example</font></h3>
<p>Last generated on: <asp:label id="msg" runat="server"/>

I think you will need to overview these conference materials for further details:

Also there are several ASP.NET forums on the Microsoft Forum pages.

Back to Web Development Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums