I have implemented a VirtualPathProvider. The VirtualPathProvider reads the view from File system.
However my problem is the method GetFile(string virtualPath)
public class MyVirtualPathProvider : VirtualPathProvider
{
public override CacheDependency GetCacheDependency(string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
{
return null;
}
public override String GetFileHash(String virtualPath, IEnumerable virtualPathDependencies)
{
return Guid.NewGuid().ToString();
}
}
I found the solution myself on the internet.
Really thanks jbeall replied on 07-15-2008, 11:05 AM.
http://forums.asp.net/t/1289756.aspx
In short words, overrides the following methods
GetCacheDependency
- always return nullGetFileHash
- always return different valueAfter these modifications, for every request, MVC gets the file from source directly.