I am looking to get the route template from a request. I am using OwinMiddleware and am overriding the Invoke method accepting the IOwinContext.
public override async Task Invoke(IOwinContext context)
{
...
}
Given the Request URL: http://api.mycatservice.com/Cats/1234
I want to get "Cats/{CatId}"
I have unsuccessfully tried converting it using the following approachs:
HttpRequestMessage msg = new HttpRequestMessage(new HttpMethod(context.Request.Method), context.Request.Uri);
HttpContextBase httpContext = context.Get<HttpContextBase>(typeof(HttpContextBase).FullName);
For reference:
Here is a post about how to do this using HttpRequestMessage which I have successfully implemented for another project