You must Sign In to post a response.
  • Category: ASP.Net MVC

    What is the route data


    Could anyone tell me what is Route Data in mvc.

  • #763366
    RouteData contains the values for a current requested route

    In the RoutConfig.cs we are registering the controller,action,id etc as follows

    public static void RegisterRoutes(RouteCollection routes)

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

    At the run time we can get this values using RoutData.


    By Nathan
    Direction is important than speed

  • #763374
    Hello Venkateswarao,

    You can google this query. You will get more example of codes and theories about route data.

    In simple words Routing is the way of constructing meaningful URLs for a web request. RouteData.Values is used for accessing the values/querystring values inserted by the classes handling routing.

    You can go through some links for deep reference :

    Hope this will help you.

    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • #763395

    I would suggested you to go through the below link to know more about Route Data, "".

    We are here to help you while you are facing any typical issues, we didn't work out to guide you how to start learning, if you search the same in google you may found N no of articles and post regarding the same, I request you to please go through those and still you have a doubt please let us know.

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #763429
    Hi venkateswarao.

    Unlike applications , MVC applications work like url pattern.
    By creating mvc application you will find a Route.Config.cs file in App_Start folder.

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

    You can specify your own controller, action and id like below based on your requirement.

    Sridhar Thota.
    Editor: DNS Forum.

  • Sign In to post your comments