VirtualPathUtility.MakeRelative(String, String) 메서드

정의

루트 연산자(타일드 [~])가 포함된 한 가상 경로에서 다른 가상 경로로의 상대 가상 경로를 반환합니다.

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 가 루팅되지 않았습니다.

설명

fromPathtoPath 매개 변수가 루팅되지 않은 경우, 즉 루트 연산자(타일드 [~])와 같지 않거나, 타일 및 슬래시 표시(~/) 또는 타일과 이중 백슬래시(~/)와 같은 타일드(~)로 시작하지 않거나 슬래시 표시(/)ArgumentException로 시작하지 마세요.

URI에 사용되는 쿼리 문자열 매개 변수 및 HTML 앵커는 상대 경로를 결정하는 데 사용되지 않습니다.

is와 fromPath is "/directory1/file1.aspx"toPath이면 "/directory2/file2.aspx" 메서드가 MakeRelative 반환됩니다"../directory2/file2.aspx".

적용 대상

추가 정보