lapucca
asked on
Do I need to further validate an int variable return to my from an api?
Hi, I'm using VS2013, C# and asp.net web form
I use Server.HtmlEncode for all the strings type of variable that I got back from calling 3rd party api. What if the return type if int, can I just count on C# being strong type and would take care of that or do I need to do further validation and how?
Thank you.
I use Server.HtmlEncode for all the strings type of variable that I got back from calling 3rd party api. What if the return type if int, can I just count on C# being strong type and would take care of that or do I need to do further validation and how?
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think that's what David Johnson is showing you. If the value returned isn't an integer, then you'll get an exception. Make sure you handle the exception, though.
ASKER
Not exactly the same but okay. Thank you both.
ASKER