top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to enable Attribute Routing?

0 votes
336 views
How to enable Attribute Routing?
posted Sep 30, 2016 by Latha

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Just add @Model.CustomerName the method : "MapASP.Net MVCAttributeRoutes()" to enable attribute routing as shown below:

public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        //enabling attribute routing
        routes.MapASP.Net MVCAttributeRoutes();
        //convention-based routing
        routes.MapRoute
        (
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Customer", action = "GetCustomerList", id = UrlParameter.Optional }
        );
    }
answer Sep 30, 2016 by Shivaranjini
...