Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have API that have one parameter string UserId a but while testing it accept any parameter after the parameter i have defined like this


http://localhost:xxxx/api/get?UserId=43141688 its shows the result I wanted but if I do like this

http://localhost:xxxx/api/get?UserId=43141688?id=7897?id=4564 its also shows the same result

"http://localhost:xxxx/api/get?UserId=43141688&xyzpqrand also gets the same result on the basis of UserId



so how to do parameter binding basis of my parameter no additional (? and & )include only UserId?

What I have tried:

C#
I already tried attribute based routing and action-based routing 
Posted
Updated 11-Oct-16 21:34pm
v3
Comments
Suvendu Shekhar Giri 12-Oct-16 3:08am    
"?id=7897?id=4564"

what it means?
is this even valid?
Rahul_Jyala 15-Oct-16 8:21am    
no they are not valid that is my worry
also it does not give errors I'm hoping it should give error instead of those if I use
http://localhost:xxxx/api/get?UserId=43141688&xyz
or http://localhost:xxxx/api/get?UserId=43141688&&qwerty
does the same result.where UserId is valid and i have only one parameter
[no name] 21-Oct-16 16:32pm    
I am not sure I understand what you are asking. You don't want users to add additional parameters?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900