views:

16

answers:

0

Hi,

I am a bit slow on the up-take of the Virtual Path Provider class and it's use, so only now have I started to play around with it.

But I have hit a problem with the GetCacheDependency method, which is supplied in some code from the MSDN Example, or the same code is provided as a working example from this site

The code:

public override CacheDependency GetCacheDependency(
  string virtualPath, 
  System.Collections.IEnumerable virtualPathDependencies, 
  DateTime utcStart)
{
  if (IsPathVirtual(virtualPath))
  {
    System.Collections.Specialized.StringCollection fullPathDependencies = null;

    // Get the full path to all dependencies.
    foreach (string virtualDependency in virtualPathDependencies)
    {
      if (fullPathDependencies == null)
        fullPathDependencies = new System.Collections.Specialized.StringCollection();

      fullPathDependencies.Add(virtualDependency);
    }
    if (fullPathDependencies == null)
      return null;

    // Copy the list of full-path dependencies into an array.
    string[] fullPathDependenciesArray = new string[fullPathDependencies.Count];
    fullPathDependencies.CopyTo(fullPathDependenciesArray, 0);
    // Copy the virtual path into an array.
    string[] virtualPathArray = new string[1];
    virtualPathArray[0] = virtualPath;

    return new CacheDependency(virtualPathArray, fullPathDependenciesArray, utcStart);
  }
  else
    return Previous.GetCacheDependency(virtualPath, virtualPathDependencies, utcStart);
}

Everything works great in the working example where the content for each Virtual page is held in an xml document and the page template is help in a .txt file. Each virtual page is a .htm file.

I have updated a single page to be a .aspx page, and added a user control to the template. The user control has 1 label, and on page_load it is given its value.

So now the Virtual file has a physical user control, but when debugging I get an error: "Absolute Path Information is Required".

fullPathDependenciesArray

Contains:
/VirtualPathProvider/Control1.ascx (physical file)
/VirtualPathProvider/Control1.cs (physical file)
/vrDir/Level1File1.aspx (virtual file)

Now from searching around the web, it seems as though this code has never worked but no one has posted a solution to the problem.

Any pointers would be great!
Thanks