I have a virtual path provider. Problem is its caching my files. Whenever I manually edit one of the aspx files it references the VPP doesn't pull in the new file, it continues to reuse the old file until I restart the site.
I've even over-rode the GetCacheDependency() in my VirtualPathProvider class:
public override CacheDependency GetCacheDependency(string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
{
return null;
}
Ideas?
Returning a null is essentially telling ASP.NET that you do not have any dependency - hence ASP.NET will not reload the item.
What you need is to return a valid dependency e.g.
public override CacheDependency GetCacheDependency(string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
{
return new CacheDependency(getPhysicalFileName(virtualPath));
}
A more correct approach is to make sure that you only handle your own cache dependencies (this is a schematic example) :
public override CacheDependency GetCacheDependency(string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
{
if (isMyVirtualPath(virtualPath))
return new CacheDependency(getPhysicalFileName(virtualPath));
else
return new Previous.GetCacheDependency(virtualPath, virtualPathDependencies, utcStart);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With