Greetings! I am currently facing an issue while attempting to send two objects using the HTTP POST method to the backend server
My development environment consists of Angular 4, TypeScript, and ASP.NET MVC 5
Upon sending the two objects, I encounter a 500 internal server error
Interestingly, when I send just a single object, the backend method is successfully called
Below is the code snippet for passing a single object:
clientSidePostCall(Results:any,Details:any):Observable<any>{
return this._http.post(Global.ENDPOINT +'BackendMethod/',Results)
.map((response: Response) => <any>response.json())
.catch((err:any) => { throw err; });
}
The above code functions properly when sending the Results object to the BackendMethod as a single parameter
However, it fails when attempting to pass multiple objects to BackendMethod that expects two objects.
clientSidePostCall(Results:any,Details:any):Observable<any>{
return this._http.post(Global.ENDPOINT +'BackendMethod/',Results,Details)
.map((response: Response) => <any>response.json())
.catch((err:any) => { throw err; });
}
As mentioned earlier, the above code triggers a 500 internal server error
Here is the signature of my backend method:
[HttpPost]
public HttpResponseMessage BackendMethod([FromBody] resultsType Results, [FromBody] detailsType Details)
I would greatly appreciate any assistance on resolving this issue
Additionally, I have a question regarding whether we can pass objects in an HTTP GET request in Angular 4 and TypeScript