What Is Attribute based Routing? MVC 5 supports a new type of routing that called attribute routing. It used to define routes. Enable Attribute Routing - If you want to use Attribute Routing, you must enable it by calling MapMvcAttributeRoutes on the RouteCollection. public class RouteConfig { public static void RegisterRoutes ( RouteCollection routes ) { routes . IgnoreRoute ( "{resource}.axd/{*pathInfo}" ); //Enables Attribute Routing routes . MapMvcAttributeRoutes (); } } Defining a Route - A route attribute has to be defined on top of an action method or on the top of a controller. The Example looks like, public class HomeController : BaseController { [ Route ( "User/GetUsers" )] public Act...
Angular, React, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, TypeScript and Interview Questions Answers