UriTemplateMatch.RequestUri Property


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)
// Code output:
// RequestUri:
// http://localhost/weather/WA/Seattle?forecast=today

.NET Framework
Available since 3.5
Return to top