Reputation: 891
I´ve got a REST-Source which is localhost/admin/users/{userName}
but my user has a '.' in it, so I can´t pass it through the route.
My Question is how to pass spezial chars through a REST-API?
I tried to escape the '.' with %2E but the RESTed extension for Firefox tells me the route does not exist.
[HttpGet]
[Route("users/{userName}")]
public User GetUser(string userName)
{
// some logig here
return new User(userName);
}
I hoped to find a way to escape such chars :-/
Upvotes: 0
Views: 52
Reputation: 16701
You can add a trailing slash /
to the URL if it contains a dot .
:
localhost/admin/users/{userName}/
The API sees the .
and thinks you're trying to access a file. Adding a trailing slash should fix this.
Upvotes: 1