forum

Home / DeveloperSection / Forums / How routing works in ASP.NET MVC4

How routing works in ASP.NET MVC4

Anonymous User 1980 29-Sep-2014

I'm developing an ASP.NET MVC4 application and I'm new. I have two MapRoutes for routing. 

routes.MapRoute("Char", 
                "ABC/Alpha/{number1}",
                 defaults: new { Controller = "ABC", action = "Alpha" });          
 
routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index",  id=UrlParameter.Optional }
        );

I didn't assign any default value to the number1 in the MapRoutes. But I know it is mandatory because it is in the URL path. 

If I didn't provide any parameter in the url (when I run the app), I should get an error but I didn't.

Can anyone help me?


Updated on 29-Sep-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By