Question

Here is the scenario, I have a WCF service call that takes one string parameter and that string has slashes in it (e.g. "123/456.xml"). I want to setup a UriTemplate like this "/{file}" so that I can access the method at http://www.example.com/File.svc/123/456.xml rather than http://www.example.com/File.svc/GetFile?file=123/456.xml.

Is this possible with UriTemplate?

  • I realize that I could setup a UriTemplate like "/{directory}/{file}" but that is not an option because there is a variable number of directories.
Was it helpful?

Solution

Alright, I found a solution on MSDN. UriTemplates support wildcard segments which basically mean the rest of the path. So I can specify a UriTemplate like "/{*file}" and it will work as expected.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top