System.Web.VirtualPathUtility.GetFileName Method

Retrieves the file name of the file that is referenced in the virtual path.

Syntax

public static string GetFileName (string virtualPath)

Parameters

virtualPath
The virtual path.

Returns

The file name literal after the last directory character in virtualPath; otherwise, the last directory name if the last character of virtualPath is a directory or volume separator character.

Remarks

If the virtual path that is passed into the VirtualPathUtility.GetFileName(string) method is "/images/image1.gif", the returned file name is "image1.gif".

Requirements

Namespace: System.Web
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0