This project is read-only.

UriTemplate and escaped '/'

Topics: ASP.NET Web API
May 13, 2012 at 12:52 AM


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 13, 2012 at 12:55 AM

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


May 13, 2012 at 1:00 AM

Thanks Henrik...

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


May 13, 2012 at 1: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 1: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?