I am working on a framework where .aspx and .master pages are embedded in an assembly, using VirtualPathProvider to route a url to a specific embedded resource.
Sample url: /_framework.aspx/mypage.aspx (which uses /_framework.aspx/mymaster.master)
- _framework.aspx will make IIS6 route the request through ASP.NET framework
- everything after the .aspx is treated as a PathInfo in the .NET framework
In Visual Studio 2008 web server, the virtualPath is correctly: /_framework.aspx/mypage.aspx but in IIS6 the virtualPath is: /_framework.aspx
If I request two files: /_framework.aspx/file1.css and /_framework.aspx/file2.css the file2 will have the same content as file1.
I suspect that IIS6 considers the file path (_framework.aspx) and caches the file stream which is returned from the assembly, thus treating both urls as the same file.
Temporary solution:
I've implemented a CacheDependency class like this
class ImmediateExpiryCacheDependency : System.Web.Caching.CacheDependency
{
public ImmediateExpiryCacheDependency()
{
base.NotifyDependencyChanged(null, null);
}
}
It now expires the file stream cache, but doens't work with master pages, I guess because it is requested before the cache is expired through NotifyDependencyChanged.
Needed solution:
If I returned null in GetCacheDependency, IIS6 doesn't expire the file immediately. What is the correct way to immediately expire a file or disable the caching entirely. Even better, I would like to correct the way that IIS6 deals with the url, since the caching is actually good, if it would use the full file url.