I have a Web API 2 controller. I am sending a JavaScript Object from the client in a call:
myObject = {propertyOne: 'Hi', propertyTwo: 'Bye'}
Do I HAVE to make a class with those properties in C# to receive the object as an argument to the Web API controller?
public void controllerMethod(myObject object)
{
}
Is there away to AVOID making an object that will only be used to receive data? If so, how?
the below would work, but not recommended.
Among a number of benefits, it's a positive security benefit to create an object and bind it so that you can't get extra properties posted in from an attacker that are not intended to be there.