Need Help With ASP.NET Custom Route

Posted by Jason on Stack Overflow See other posts from Stack Overflow or by Jason
Published on 2010-05-21T20:58:58Z Indexed on 2010/05/21 21:00 UTC
Read the original article Hit count: 167

Filed under:

I need to create a custom route to list all the rooms in a given building. So, I want the url to look something like this:

/Building/1000/Room

Which would list all the rooms in Building 1000.

Is this the correct mapping for the route (to call the IndexByBuilding method in RoomController)?

        routes.MapRoute(
            "RoomsByBuilding",
            "Building/{id}/Room",
            new { controller = "Room", action = "IndexByBuilding", id = "" }
            );

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2