System.Web.VirtualPathUtility.GetExtension Method

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

Syntax

public static string GetExtension (string virtualPath)

Parameters

virtualPath
The virtual path.

Returns

The file name extension string literal, including the period (.), null, or an empty string ("").

Remarks

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

Requirements

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