UriTemplateMatch.RequestUri Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets and sets the matched URI.

Namespace:   System
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public Uri RequestUri { get; set; }

Property Value

Type: System.Uri

A Uri instance.

The following code shows how to access the RequestUri property.

UriTemplate template = new UriTemplate("weather/{state}/{city}?forecast=today");
Uri baseAddress = new Uri("http://localhost");
Uri fullUri = new Uri("http://localhost/weather/WA/Seattle?forecast=today");

Console.WriteLine("Matching {0} to {1}", template.ToString(), fullUri.ToString());

// Match a URI to a template
UriTemplateMatch results = template.Match(baseAddress, fullUri);
if (results != null)
{
    Console.WriteLine("RequestUri:");
    Console.WriteLine(results.RequestUri);
}
// Code output:
// RequestUri:
// http://localhost/weather/WA/Seattle?forecast=today

.NET Framework
Available since 3.5
Return to top
Show: