In this article, you will learn how to invoke WebAPI Controller Action with Multiple Parameters in CORS Enabled Web Application.
Description It is used to invoke WebAPI Controller action with one or more than one parameters from client side in CORS enabled Web Application. Advantage
Note To install WebAPI CORS MULTI PARAMS MODELBINDER , run the following command in the Package Manager console. PM>Install-Package WebAPICORSMULTIPARAMSMODELBINDER After successful installation of above NuGet package, observe references added in your project file, as shown in below Fig.1 Do the below changes to the Global.asax.cs file before Configuring WebApiConfig.Register. In order to generate and bind marked parameters as specified in our WebAPI controller action method, we are going to add MultiPostParams attribute on it. Below Fig.2 demonstrates this: Now, let's see how to pass data with different parameters with comma separated format to WebAPI Controller Action having MultiPostParams attribute on it from client side (i.e.from CORS Enabled Web Application).The below Fig.3 demonstrates this: Fig.4 shows how to add MultiPostParams attribute to WebAPI Controller Action. Once this attribute is added just above WebAPI Controller Action, it creates/generates and binds marked parameters as specified in our WebAPI Controller action method to a specified parameter obtained from a client side call to invoke our WebAPI Controller Action. The below figure demonstrates this:
Agile Development-999