Dustin Kendall
Dustin Kendall

Reputation: 520

ServiceStack URL-decodes path, why?

I have a route at /test/{name}.

When I browse to:

/test/dkend%2Ftest

in ServiceStack, I get a 'Handler for Request not found:' error, with:

Request.Url.LocalPath: /test/dkend/test

ServiceStack is URL-decoding 'dkend%2Ftest' to dkend/test

If I do a request to an asp.net http module and look at the raw url, I get:

/test/dkend%2Ftest

as the path.

Is there a reason ServiceStack URL-decodes the path? I'd like to end up with 'dkend%2Ftest' in the {name} parameter.

Upvotes: 1

Views: 141

Answers (1)

mythz
mythz

Reputation: 143319

The urls are automatically decoded by ASP.NET before it reaches ServiceStack, i.e. this would work in HttpListener hosts which doesn't automatically decode path info urls.

One way around this is to call the service using the queryString (i.e. instead of the pathInfo), e.g:

/test?name=dkend%2Ftest

Upvotes: 4

Related Questions