Uri.OriginalString 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
생성자에 전달된 원래 URI 문자열을 Uri 가져옵니다.
public:
property System::String ^ OriginalString { System::String ^ get(); };
public string OriginalString { get; }
member this.OriginalString : string
Public ReadOnly Property OriginalString As String
속성 값
이 인스턴스가 생성될 때 지정된 정확한 URI입니다. 그렇지 않으면 . Empty
예제
다음 예제에서는 문자열에서 새 Uri 인스턴스를 만듭니다. 생성자에 전달된 문자열을 반환하는 값과 문자열의 정식 형식을 반환하는 호출ToString에서 반환OriginalString되는 값의 차이를 보여 줍니다.
// Create a new Uri from a string address.
Uri uriAddress = new Uri("HTTP://www.ConToso.com:80//thick%20and%20thin.htm");
// Write the new Uri to the console and note the difference in the two values.
// ToString() gives the canonical version. OriginalString gives the original
// string that was passed to the constructor.
// The following outputs "http://www.contoso.com//thick and thin.htm".
Console.WriteLine(uriAddress.ToString());
// The following outputs "HTTP://www.ConToso.com:80//thick%20and%20thin.htm".
Console.WriteLine(uriAddress.OriginalString);
// Create a new Uri from a string address.
let uriAddress = Uri "HTTP://www.ConToso.com:80//thick%20and%20thin.htm"
// Write the new Uri to the console and note the difference in the two values.
// ToString() gives the canonical version. OriginalString gives the original
// string that was passed to the constructor.
// The following outputs "http://www.contoso.com//thick and thin.htm".
printfn $"{uriAddress.ToString()}"
// The following outputs "HTTP://www.ConToso.com:80//thick%20and%20thin.htm".
printfn $"{uriAddress.OriginalString}"
' Create a new Uri from a string address.
Dim uriAddress As New Uri("HTTP://www.ConToso.com:80//thick%20and%20thin.htm")
' Write the new Uri to the console and note the difference in the two values.
' ToString() gives the canonical version. OriginalString gives the original
' string that was passed to the constructor.
' The following outputs "http://www.contoso.com//thick and thin.htm".
Console.WriteLine(uriAddress.ToString())
' The following outputs "HTTP://www.ConToso.com:80//thick%20and%20thin.htm".
Console.WriteLine(uriAddress.OriginalString)
End Sub
설명
생성자에 지정된 URI에 선행 또는 후행 공백이 포함된 경우 이러한 공백은 유지됩니다.
이 속성에서 반환하는 값은 ToStringAbsoluteUri다음과 다릅니다. ToString 는 URI의 비스케이프된 형식을 반환합니다. AbsoluteUri 는 URI의 정식 이스케이프 형식을 반환합니다.
IRI(International Resource Identifier) 및 IDN(Internationalized Domain Name) 지원을 사용하도록 설정 OriginalString 하면 인스턴스를 초기화하는 Uri 데 사용된 경우 Punycode 호스트 이름을 사용하여 정규화되지 않은 원래 문자열을 반환합니다. Punycode 이름은 ASCII 문자만 포함하며 항상 xn-- 접두사로 시작합니다.
IRI 지원에 대한 자세한 내용은 클래스의 설명 섹션을 Uri 참조하세요.
개체가 Uri serialize되면 유지 OriginalString 되지 않습니다. serialization 프로세스는 직렬화할 때 완전히 이스케이프되고 정식화된 AbsoluteUri 속성을 사용합니다. Uri IPv6 주소가 포함된 경우 IPv6 주소와 범위 ID가 serialize된 Uri 개체에 포함됩니다.