L C L C - 1 month ago 21
ASP.NET (C#) Question

web api Route attribute not found

I need to implement a Method in my web service, which is available by a defined route.
So I used the

Route
attribute like this:

[Route ("api/New")]
public void CreateNew(int id)
{
//Do stuff
}


But VS2013 says that the namespace "Route" can't be found.

I guess this can be solved by installing a nuget package.

Can anybody help?

Answer

Attribute Routing is native in ASP.NET MVC 5, or later, and ASP.NET Web API 2. check your MVC version it should be above the 4.