My problem comes when I call a webapi2 GET with a string parameter that has special char (with normal character all works correctly).
AngularJs
this.getByContactValue = function (contactValue) {
return $http.get("/api/subjects/"+ contactValue+ "/ContactValue" );
}
c#
[Route("api/subjects/{contactValue}/ContactValue")]
public IEnumerable<Subject> GetByContactValue(string contactValue)
{
return repository.GetByContactValue(contactValue);
}
The response is 404 error. I tried also to modify the request in this way
this.getByContactValue = function (contactValue) {
var request = $http({
method: "get",
url: "/api/subjects/ContactValue", //modified the route in c# controller
data: contactValue
});
return request;
}
But the error is the same.
Which is the best way to call the webapi?