Hello,
I am trying to reset the cache of a web method from code like this:
[WebMethod(CacheDuration=100)]
public DateTime TheTime()
{
return DateTime.Now;
}
[WebMethod]
public void ResetCache()
{
System.Reflection.MethodInfo mi = GetType().GetMethod("TheTime");
object [] attributes = mi.GetCustomAttributes(false);
foreach( object objAttribute in attributes)
{
if( objAttribute is WebMethodAttribute)
{
WebMethodAttribute webmethodAttribute =
(WebMethodAttribute)objAttribute;
webmethodAttribute.CacheDuration = 0;
//webmethodAttribute.CacheDuration =100;
}
}
}
My ResetCache() method should enforce the TheTime() method to reset but
this doesn't work. Does anybody know how to reset/flush the cache of a
web method from code?
Greetings,
Martijn Muurman