I'm new to Web API and followed some examples, but I cannot work out where the Controller Name is specified.
I have this in my global.asax:
protected void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.MapHttpRoute(
name: "API Controller",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = System.Web.Http.RouteParameter.Optional }
);
}
I have a Controller called TestAPI.cs
and this is the contents:
namespace Testing
{
public class TestAPI : ApiController
{
// GET api/<controller>
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/<controller>/5
public string Get(int id)
{
string test= "Hello!";
return test
}
}
}
I've only put "return test" in there as an example for Stack Overflow as it contains a lot of code.
So if I am consuming this in jQuery, what path would I use for the controller?
TestAPIController.