Path Utility. Make Relative(String, String) Method
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the relative virtual path from one virtual path containing the root operator (the tilde [~]) to another.
public: static System::String ^ MakeRelative(System::String ^ fromPath, System::String ^ toPath);
public static string MakeRelative (string fromPath, string toPath);
static member MakeRelative : string * string -> string
Public Shared Function MakeRelative (fromPath As String, toPath As String) As String
The starting virtual path to return the relative virtual path from.
The ending virtual path to return the relative virtual path to.
The relative virtual path from
fromPath is not rooted.
toPath is not rooted.
toPath parameters are not rooted; that is, they do not equal the root operator (the tilde [~]), do not start with a tilde (~), such as a tilde and a slash mark (~/) or a tilde and a double backslash (~//), or do not start with a slash mark (/), an ArgumentException exception is thrown.
Query string parameters and HTML anchors that are used in the URI are not used in determining the relative path.
"/directory2/file2.aspx", the MakeRelative method returns