Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

VirtualPathProvider.GetFile Method

Gets a virtual file from the virtual file system.

Namespace: System.Web.Hosting
Assembly: System.Web (in system.web.dll)

public virtual VirtualFile GetFile (
	string virtualPath
)
public VirtualFile GetFile (
	String virtualPath
)
public function GetFile (
	virtualPath : String
) : VirtualFile
Not applicable.

Parameters

virtualPath

The path to the virtual file.

Return Value

A descendent of the VirtualFile class that represents a file in the virtual file system.

The GetFile method returns a descendent of the VirtualFile class that represents the file specified by the virtualPath parameter.

The following code example is an implementation of the GetFile method in a custom VirtualPathProvider class. For the full code required to run the example, see the Example section of the VirtualPathProvider class overview topic.

public override VirtualFile GetFile(string virtualPath)
{
  if (IsPathVirtual(virtualPath))
    return new SampleVirtualFile(virtualPath, this);
  else
    return Previous.GetFile(virtualPath);
}

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.