Route Parameter Value Always 0 in ASP.NET Core 1.x -


i found strange behaviour while developing asp.net core 1.x web api app. here's code snippet

[route("{id}")] [httpget] public iactionresult get(string id) {   ... } 

if send request api endpoint /api/values/1234 works ok. now, change parameter type string int like:

[route("{id}")] [httpget] public iactionresult get(int id) {   ... } 

if send same request /api/values/1234, id value 0, not supposed be.

i tried {id:int} well, doesn't work either. tried [httpget("{id}")] , [httpget("{id:int}")] instead of using [route("{id}")]. none of them working expected.

i'm sure worked fine on asp.net core rc1 , rc2. however, doesn't work on asp.net core 1.x expected. missing?


update:

found actual implementation required long value, not int value. after changed parameter type long, worked expected.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -