VirtualPathUtility.RemoveTrailingSlash Method (String)

 

Removes a trailing slash mark (/) from a virtual path.

Namespace:   System.Web
Assembly:  System.Web (in System.Web.dll)

public static string RemoveTrailingSlash(
	string virtualPath
)

Parameters

virtualPath
Type: System.String

The virtual path to remove any trailing slash mark from.

Return Value

Type: System.String

A virtual path without a trailing slash mark, if the virtual path is not already the root directory ("/"); otherwise, null.

The RemoveTrailingSlash method removes a slash mark (/) from the end of the virtual path. If the virtual path is already the root directory ("/"), no action is taken. If the virtual path is null or an empty string (""), the RemoveTrailingSlash method returns null.

.NET Framework
Available since 2.0
Return to top
Show: