Perhaps I do not understand how to properly use the UriTemplate
I always want to search the incoming url for
api/whatever // that is it
If URL is like below, I want to ONLY get api/CheckMainVerified
So I suppose without using UriTemplate, I guess a substring check or regex would work ?
http://localhost:29001/api/CheckMainVerified/223128
This is what I was doing
var url = "http://localhost:29001/api/CheckMainVerified/223128";
//var host = new Uri(serverHost.AbsoluteUri);
var host = new Uri("http://localhost:29001");
var apiTemplate = new UriTemplate("{api}/{*params}", true);
var match = apiTemplate.Match(host, new Uri(url));
var finalSearch = match.BoundVariables["api"];
string parameters = match.BoundVariables["params"];
finalSearch.Dump();
parameters.Dump();
match.Dump();
I think you're just missing 2nd option in the template (see example below).
As such, adding the "{controller}" to the template should resolve your issue. From there, you could do a simple string comparison. i.e.
Alternatively, as you suggested; you could use a substring or regex solution.