Using the System.ServiceModel libraries for routing, I have a REST service with a simple template that looks like
"{SEARCHTERM}? Select = {someSearchOpt}
So the call will look like this:
http://myhost.contoso.com/searchapi/river%20expeditions
to find the phrase "river expeditions" without options.
It just takes a search phrase and returns results. It works great. However, if you are looking for a phrase that contains an alphanumeric ampersand such as "Lewis & Clark", I tried the obvious from ampersand url coding
Lewis% 26Clark
but even so, the request is never routed, but the server immediately returns 400 Bad Request. It is understood that it is interpreted as a query line separator and invalidates the request, since this particular template expects the url parameter and does not have the preceding '?' delimiter.
Since these search phrases may have other restricted characters, it is expected that they will be encoded by the client, and when they are successfully routed, the REST api calls HttpUtility.UrlDecode in the parameter. So my question is, is there really some method of getting a URL encoded by url, correctly routed as a url parameter to rest, and not interpreted and not interpreted as a query string delimiter?
. , ( url), Lewis% 26Clark .
http://myhost.contoso.com/searchapi?searchTerm=lewis%26clark
, , url REST.