I am working with visual basic and AJAX, I want to access the following address in my controller called Catalogos:
<HttpGet>
<ActionName("BuscarProgramacion")>
Public Function BuscarProgramacion(ByVal IdCuestionario As Integer) As List(Of ListaCatalogo)
Dim Lista = sCatalogosEncuesta.ObtenerCatalogo(IdCuestionario)
Return Lista
End Function
I have already configured the WebApiConfig as follows:
config.Routes.MapHttpRoute(
name:="DefaultApi",
routeTemplate:="api/{controller}/{id}",
defaults:=New With {.id = RouteParameter.Optional}
)
config.Routes.MapHttpRoute(
name:="ActionApi",
routeTemplate:="api/{controller}/{action}/{IdCuestionario}",
defaults:=New With {.id = RouteParameter.Optional}
)
and my AJAX function is as follows:
var url = 'http://localhost:7910/api/Catalogos/BuscarProgramacion/5';
$.ajax({
url: url,
headers: { "Authorization": "Bearer " + OnLoadRA.token },
type: 'GET',
cache: false,
statusCode: {
200: function (data) {
alert(data);
},
404: function (error) {
jAlertError('Error al cargar la información.', 'Mensaje del servidor')
}
}
});
but I can not access the driver, I get the following error:
{"Message": "No HTTP resource found matching the URI of the request ' link '. "," MessageDetail ":" No action was found on the' Catalogs' controller that matches the name 'SearchProgramming'. "}