0

I got a Web Api project, and I want to call a api controller through this URL:

Http://localhost:3030/GetByCoordinates/[[0,1],[1,1],[1,0],[0,0]]

It works fine, but when I try to add a double number (like 1.1 instead of 1) the browser throws 404 not found exception, because the dot make it look like another address.

How can i handle doubles ?

Lironess
  • 823
  • 1
  • 11
  • 19

2 Answers2

3

Try adding '/' at the end of the URL, e.g.

Http://localhost:3030/GetByCoordinates/[[0,1],[1,1.1],[1,0],[0,0]]/

Reference: Why is my Web API method with double args not getting called?

Community
  • 1
  • 1
eddiecjc
  • 222
  • 2
  • 5
  • I tested this with WebApi2 and it works. If you don't add the slash at the end, you can't have a float at the end. – snowcode Jun 03 '15 at 15:36
0

This isn't strictly the query string, but unless you can configure your MVC project (or, more specifcally, probably IIS) to allow/manage certain mappings (or not to manage them, in a given case perhaps) then you should be able to translate the character from one form to another.

That is, you could swap periods out for %2E, and swap them back in on the server side.

Grant Thomas
  • 44,454
  • 10
  • 85
  • 129