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 }
- );
- }
- }
TestingController- public class TestingController : Controller
- {
-
-
- [Route("demo")]
- public ActionResult Index()
- {
- return View();
- }
-
- public ActionResult products()
- {
- return Content("All products");
- }
- }
This is a simple demo program only but banging my head to figure out why it is not working.
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.