Click here to Skip to main content
15,919,245 members
Home / Discussions / C#
   

C#

 
General"event bubbling" for winform control Pin
kasturirawat7-Jan-02 12:43
kasturirawat7-Jan-02 12:43 
GeneralRe: "event bubbling" for winform control Pin
Senkwe Chanda8-Jan-02 21:35
Senkwe Chanda8-Jan-02 21:35 
GeneralRe: "event bubbling" for winform control Pin
kasturirawat9-Jan-02 6:05
kasturirawat9-Jan-02 6:05 
GeneralRe: "event bubbling" for winform control Pin
Senkwe Chanda9-Jan-02 20:59
Senkwe Chanda9-Jan-02 20:59 
GeneralRe: "event bubbling" for winform control Pin
Senkwe Chanda11-Jan-02 3:26
Senkwe Chanda11-Jan-02 3:26 
GeneralProxy Settings in C# Pin
Ray Hayes5-Jan-02 4:38
Ray Hayes5-Jan-02 4:38 
GeneralASP.NET Pin
Matt.W.3-Jan-02 11:59
Matt.W.3-Jan-02 11:59 
GeneralCacheItemRemovedCallback Problems Pin
Tim Bajz3-Jan-02 3:13
Tim Bajz3-Jan-02 3:13 
Guys,

I am having problems with the use of the CacheItemRemovedCallback event within an ASP.NET/C# website I am building. The below code is from my global.aspx file. The code loads XML/XSL objects into the Cache for later use. I also create a Cache dependency so should any files change which my XML/XSL objects use, the Cache is updated automatically. The code works only when something is removed from the Cache by another aspx file, since the code correctly identifies the HttpContext. However, when one of my files is changed and the RemovedCallback() function is fired, for some reason the Context and the HttpContext are both null. As such my code never has a chance to update the Cache again. Rather it exists "without an error" as soon as I try to use Cache.Insert. Does anyone know if this is a bug in Beta 2, or am I missing something, like the use of a special Context object?

Any help greatly appreciated..........

Cheers,
Tim.

<%@ Import Namespace="System.Xml.Xsl" %>
<%@ Import Namespace="System.Xml.XPath" %>
<%@ Import Namespace="System.Web.Caching" %>
<%@ Import Namespace="CommerceEngine.Common" %>



private static CacheItemRemovedCallback onRemove = null;
private XPathDocument CommerceListXmlObj;
private XslTransform CommerceListXslObj;

public void Application_OnStart()
{
ApplicationConfiguration.OnApplicationStart(Context.Server.MapPath( Context.Request.ApplicationPath ));
onRemove = new CacheItemRemovedCallback(this.RemovedCallback);

CommerceListXmlObj = new XPathDocument(CommerceEngineConfiguration.CommerceListXmlFilePath);
HttpContext.Current.Cache.Insert("CommerceListXmlObj", CommerceListXmlObj, new CacheDependency (CommerceEngineConfiguration.CommerceListXmlFilePath), DateTime.Now.AddHours(1), TimeSpan.Zero, CacheItemPriority.Default, CacheItemPriorityDecay.Slow, onRemove );

CommerceListXslObj = new XslTransform();
CommerceListXslObj.Load(CommerceEngineConfiguration.CommerceListXslFilePath);
HttpContext.Current.Cache.Insert("CommerceListXslObj", CommerceListXslObj, new CacheDependency(CommerceEngineConfiguration.CommerceListXslFilePath), DateTime.Now.AddHours(1), TimeSpan.Zero, CacheItemPriority.Default, CacheItemPriorityDecay.Slow, onRemove );
}

public void RemovedCallback(String k, Object v, CacheItemRemovedReason r)
{
switch(k)
{
case "CommerceListXmlObj" :

CommerceListXmlObj = new XPathDocument(CommerceEngineConfiguration.CommerceListXmlFilePath);
HttpContext.Current.Cache.Insert("CommerceListXmlObj", CommerceListXmlObj, new CacheDependency(CommerceEngineConfiguration.CommerceListXmlFilePath), DateTime.Now.AddHours(1), TimeSpan.Zero, CacheItemPriority.Default, CacheItemPriorityDecay.Slow, onRemove );
break;
}
}


GeneralConsole app question Pin
Krista Crawley-Archer3-Jan-02 2:37
Krista Crawley-Archer3-Jan-02 2:37 
GeneralRe: Console app question Pin
James T. Johnson4-Jan-02 11:46
James T. Johnson4-Jan-02 11:46 
GeneralRe: Console app question Pin
Krista Crawley-Archer4-Jan-02 11:50
Krista Crawley-Archer4-Jan-02 11:50 
GeneralRe: Console app question Pin
James T. Johnson4-Jan-02 13:13
James T. Johnson4-Jan-02 13:13 
GeneralRe: Console app question Pin
Valer BOCAN24-Jan-02 21:17
Valer BOCAN24-Jan-02 21:17 
Generalcasting (headaches) Pin
Senkwe Chanda3-Jan-02 0:22
Senkwe Chanda3-Jan-02 0:22 
GeneralRe: casting (headaches) Pin
James T. Johnson3-Jan-02 0:42
James T. Johnson3-Jan-02 0:42 
GeneralRe: casting (headaches) Pin
Senkwe Chanda3-Jan-02 0:53
Senkwe Chanda3-Jan-02 0:53 
GeneralRe: casting (headaches) Pin
James T. Johnson3-Jan-02 1:07
James T. Johnson3-Jan-02 1:07 
GeneralInstr Pin
2-Jan-02 14:04
suss2-Jan-02 14:04 
GeneralRe: Instr Pin
James T. Johnson2-Jan-02 18:14
James T. Johnson2-Jan-02 18:14 
Generalobtaining drive information Pin
hotlemonade2-Jan-02 13:47
hotlemonade2-Jan-02 13:47 
GeneralWin32 APi with C# Pin
kasturirawat31-Dec-01 13:54
kasturirawat31-Dec-01 13:54 
GeneralRe: Win32 APi with C# Pin
James T. Johnson31-Dec-01 19:59
James T. Johnson31-Dec-01 19:59 
GeneralRe: Win32 APi with C# Pin
kasturirawat2-Jan-02 6:39
kasturirawat2-Jan-02 6:39 
GeneralRe: Win32 APi with C# Pin
James T. Johnson2-Jan-02 9:50
James T. Johnson2-Jan-02 9:50 
GeneralTAPI Pin
31-Dec-01 4:27
suss31-Dec-01 4:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.