Provides utility methods for common virtual path operations.
Assembly: System.Web (in System.Web.dll)
Appends the literal slash mark (/) to the end of the virtual path, if one does not already exist.
Combines a base path and a relative path.
Returns the directory portion of a virtual path.
Retrieves the extension of the file that is referenced in the virtual path.
Retrieves the file name of the file that is referenced in the virtual path.
Returns a Boolean value indicating whether the specified virtual path is absolute; that is, it starts with a literal slash mark (/).
Returns a Boolean value indicating whether the specified virtual path is relative to the application.
Returns the relative virtual path from one virtual path containing the root operator (the tilde [~]) to another.
Removes a trailing slash mark (/) from a virtual path.
Converts a virtual path to an application absolute path.
Converts a virtual path to an application absolute path using the specified application path.
Converts a virtual path to an application-relative path using the application virtual path that is in the AppDomainAppVirtualPath property.
Converts a virtual path to an application-relative path using a specified application path.
Use theclass when you need to convert application-relative paths to absolute virtual paths, as might be the case in developing a custom Web service handler.
An absolute virtual path starts with the literal slash mark (/). A relative virtual path is relative to the application root directory, if it is just a tilde (~) or starts with the tilde and a double backslash (~\\) or the tilde and a slash mark (~/). Making a virtual path relative makes the path independent of the application.
The following code example demonstrates how to use the FilePath property generates the virtual path to the Web page. The GetFileName, GetExtension, and GetDirectory methods return information about the virtual path. Next, the CurrentExecutionFilePath property generates a virtual path of the current request, which might be different from the FilePath property, if a Redirect method was called. The IsAbsolute, IsAppRelative, and ToAppRelative methods return information about the virtual path.class and some of its methods. First, the
Available since 2.0
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.