Hi I have created a small demo application to test Attribute based routing but no luck till now. Need some suggestions.
Route.config class
- public class RouteConfig
- {
- public static void RegisterRoutes(RouteCollection routes)
- {
- routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
- routes.MapMvcAttributeRoutes();
- routes.MapRoute(
- name: "Default",
- url: "{controller}/{action}/{id}",
- defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
- );
- }
- }
- public class TestingController : Controller
- {
- // GET: Testing
- [Route("demo")]
- public ActionResult Index()
- {
- return View();
- }
- public ActionResult products()
- {
- return Content("All products");
- }
- }
For your reference I am using visual studio 2015.
http://localhost:1352/Testing/products: This one is working
http://localhost:1352/Testing/demo : This one is not working
Please suggest something.

Srikant MaruwadaPosted Jan 4, 2018, 5:23 AM
AjeeshPosted Jan 3, 2018, 9:54 AM