Gets the absolute path of the resource identified by the current instance.
A string containing the absolute path to the resource.
This property is read-only.
The Uri.AbsolutePath property contains the path to the resource identified by the current instance. The Uri.AbsolutePath property always returns at least a slash ('/').
If, when the current instance was constructed, the URI was already escaped or the constructor's dontEscape parameter was set to false , the value returned by this property is escaped.
Note: The path information does not include the scheme, host name, query, or fragment components of the URI.
The following example outputs the absolute path of a URI.
C# Example
using System; public class UriTest { public static void Main() { Uri myUri = new Uri ("http://www.contoso.com/URI/Hello%20World.htm?date=today", true); Console.WriteLine(myUri.AbsolutePath); } }The output is
/URI/Hello%20World.htm
Namespace: System
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0