VirtualPathUtility.MakeRelative(String, String) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ルート演算子 (チルダ [~]) を含む仮想パス間の相対仮想パスを返します。
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
パラメーター
- fromPath
- String
相対仮想パスを返す開始仮想パス。
- toPath
- String
相対仮想パスを返す終了仮想パス。
返品
fromPathからtoPathへの相対仮想パス。
例外
注釈
fromPathパラメーターと toPath パラメーターがルート化されていない場合、つまり、ルート演算子 (チルダ [~]) と等しくない場合、チルダやスラッシュ (~/) やチルダ、二重円記号 (~//) など、チルダ (~) で始まらず、スラッシュ (/) で始まっていないか、ArgumentException例外がスローされます。
URI で使用されるクエリ文字列パラメーターと HTML アンカーは、相対パスの決定には使用されません。
fromPathが"/directory1/file1.aspx"され、toPathが"/directory2/file2.aspx"されている場合、MakeRelative メソッドは"../directory2/file2.aspx"を返します。