Modifier

Partager via


VirtualPathUtility.ToAbsolute Method

Definition

Converts a virtual path to an application absolute path.

Overloads

ToAbsolute(String)

Converts a virtual path to an application absolute path.

ToAbsolute(String, String)

Converts a virtual path to an application absolute path using the specified application path.

ToAbsolute(String)

Converts a virtual path to an application absolute path.

public:
 static System::String ^ ToAbsolute(System::String ^ virtualPath);
public static string ToAbsolute (string virtualPath);
static member ToAbsolute : string -> string
Public Shared Function ToAbsolute (virtualPath As String) As String

Parameters

virtualPath
String

The virtual path to convert to an application-relative path.

Returns

The absolute path representation of the specified virtual path.

Exceptions

virtualPath is not rooted.

A leading double period (..) is used to exit above the top directory.

Remarks

An application absolute path is one where the application path is used instead of the root operator (the tilde [~]).

If virtualPath is:

  • Absolute, the ToAbsolute method returns the virtual path unchanged.

  • Application relative, the ToAbsolute method appends the current application virtual directory path to the beginning of the virtualPath. For example, the current application virtual directory path can be accessed from the AppDomainAppVirtualPath property.

  • Not rooted, the ToAbsolute method raises an ArgumentOutOfRangeException exception.

See also

Applies to

ToAbsolute(String, String)

Converts a virtual path to an application absolute path using the specified application path.

public:
 static System::String ^ ToAbsolute(System::String ^ virtualPath, System::String ^ applicationPath);
public static string ToAbsolute (string virtualPath, string applicationPath);
static member ToAbsolute : string * string -> string
Public Shared Function ToAbsolute (virtualPath As String, applicationPath As String) As String

Parameters

virtualPath
String

The virtual path to convert to an application-relative path.

applicationPath
String

The application path to use to convert virtualPath to a relative path.

Returns

The absolute virtual path representation of virtualPath.

Exceptions

applicationPath is not rooted.

A leading double period (..) is used in the application path to exit above the top directory.

Remarks

The ToAbsolute overload of the ToAbsolute method uses the supplied application path rather than the current application path.

If virtualPath is:

See also

Applies to