c# .net Adsense ADO.NET Linq Viruses/security asp.net MVC JQuery Angular-js Node-js SEO Java C++ SQL API Networking vb.net .Net Css JavaScript Generics c#.Net entity framework HTML Website host Website Construction Guide HTTP tutorial W3C tutorial Web Services JSON Psychology Ionic framework Angular ReactJS Python Computer Android
asp.net MVC

What is Routing in asp.net mvc?

| | ASP-NET , MVC

Routing is nothing but simply your mvc url. What mean is that simply your url. for example some developers using some kinds of prefix name cls with class name and also given method name as their own idea. These kinds of things definitely end user will not understand for rectify those problem we have to use routing in mvc. 

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(

                name: "Default",

                url: "{controller}/{action}/{id}",

                defaults: new { controller = "Home", action= "Index", id = UrlParameter.Optional }

            );

 

Description:

Routes is route collection and MapRoute is method name for routes. MapRoute have three arguments like name, url and defaults. Here name is key name and its unique.

IgnoreRoute methods used to do not allow user to invoke such kind of file .axd 

routes.MapRoute(

                name: "Home",

                url: "",

                defaults: new { controller = "Employee", action= "Index", id = UrlParameter.Optional }

            );

 

Here when I build the application it will automatically call Index view with in Employee Controller. Please remember one thing default name unique will come last why because if you set default name as first none of your  matching url will not execute.