VirtualPathUtility.Combine Method (String, String)


Combines a base path and a relative path.

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

public static string Combine(
	string basePath,
	string relativePath


Type: System.String

The base path.

Type: System.String

The relative path.

Return Value

Type: System.String

The combined basePath and relativePath.

Exception Condition

relativePath is a physical path.


relativePath includes one or more colons.


relativePath is null or an empty string.


basePath is null or an empty string.

TheCombine method returns the value of the AppDomainAppVirtualPath property if the relative path is exactly a tilde (~).

The Combine method uses the AppDomainAppVirtualPath property value rather than the base path, if the relative path starts with a tilde and a slash mark (~/); otherwise, the Combine method uses the base path.

.NET Framework
Available since 2.0
Return to top