javascript - Web API - Reserved Word? -
**have simple web api:
webapiconfig.cs:
config.routes.maphttproute( name: "defaultapi", routetemplate: "api/{controller}/{action}/{id}", defaults: new { id = routeparameter.optional});
i can make calls web api calling via data service controller:
[httpget] public httpresponsemessage getusers(string id) { var cl = _securityrepository.getusers(id); return request.createresponse(httpstatuscode.ok, cl); }
logic simple: searches db last names start last 3 letter in id
the call:
the results:
[ { "userid": "dlopez", "firstname": "don", "lastname": "lopez", "department": "information technology" }, { "userid": "sloper", "firstname": "steve", "lastname": "loper", "department": "first services" }, { "userid": "dlopes", "firstname": "davey", "lastname": "lopes", "department": "public info" } ]
it works great. yeah! however, in 1 circumstance resource cannot found error call:
i can use id=can, cone, com, etc,... there no problems of api calls. work great. search on con -> resource cannot found! have clue? i'm lost.
yep, "con" reserved word , not allowed. workaround include following under <system.web>
in web.config.
<httpruntime relaxedurltofilesystemmapping="true" />
taken this answer.
Comments
Post a Comment