UriTemplateMatch.BaseUri 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 base URI for the template match.

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

Public Property BaseUri As Uri

Property Value

Type: System.Uri

A Uri instance that represents the base URI for the template match.

The following code shows how to access the BaseUri property.

Dim template As New UriTemplate("weather/ state}/ city}?forecast=today")
Dim baseAddress As New Uri("http://localhost")
Dim fullUri As 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
Dim results As UriTemplateMatch = template.Match(baseAddress, fullUri)
If (results IsNot Nothing) Then

    'BaseUri
    Console.WriteLine("BaseUri:  0}", results.BaseUri)
End If
'output:
'BaseUri: http://localhost

.NET Framework
Available since 3.5
Return to top
Show: