Returns the specified Uri as a relative URI.
[Edit]
[System.Obsolete("Use MakeRelativeUri(Uri uri) instead.")] public string MakeRelative (Uri toUri) |
|
Parameters
- toUri
- The URI to compare to the current URI.
[Edit]
Returns
A string with
the difference between the current instance and toUri if the two
URIs are the same except for the path information. If the two
URIs differ in more than the Uri.AbsolutePath, this method returns the string
representation of toUri.
[Edit]
Remarks
Example
The following example demonstrates the Uri.MakeRelative(Uri)
method.
C# Example |
using System;
public class UriTest {
public static void Main() {
Uri myUri = new Uri("http://www.contoso.com/Hello%20World.htm", true);
Console.WriteLine(myUri.ToString());
Console.WriteLine(myUri.MakeRelative(new Uri ("http://www.contoso.com/index.htm")));
}
}
|
The output is
http://www.contoso.com/Hello World.htm
index.htm
Requirements
Namespace: System
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0