UriTemplate and escaped '/'

Topics: ASP.NET Web API
May 12, 2012 at 11:52 PM


Just in case this is indeed a problem and hasn't been fixed in post VS 11 RC builds...

I have a typical controller that looks like this...


I get a 404 when I try an HTTP request against URIs such as...


I would very much like for the '/' to be part of my {id}.

I hope this helps.



May 12, 2012 at 11:55 PM

It may be that ASP decodes it for us but we can have a look.


May 13, 2012 at 12:00 AM

Thanks Henrik...

BTW... the same applies for an escaped "#".


May 13, 2012 at 12:19 AM

Hi savas,

Can you try using this route instead:


Note that there's a "*" before the id parameter, which means to capture everything until the end of the path. We call it a catch-all parameter.

Hopefully that works for you!



May 13, 2012 at 12:23 AM

Thanks Eilon,

This indeed works. Many thanks.

Unfortunately, though, my goal is to support URIs like this as well...


where {id} is an escaped URI.

Wouldn't {*id} prevent me from doing the above?