views:

817

answers:

3

No matter what you read about ASP.NET routing or REST I think the best way to learn more about them is to read other people's routing files. In a video with Jeff once you could catch a glimpse of the stackoverflow routing file if you paused the video in the right place. I actually learnt quite a lot just looking at how it was organized.

To that end - does anybody want to post their routing data (in full or in part) from global.asax.cs for others to learn from? I'll post mine when its more organized - kind of messy now.

Tip: Not that you should have any security holes - but you might want to check that theres nothing 'secret' in your file before you post it.

+1  A: 

Here's an example of a live application.

http://www.codeplex.com/Kigg/SourceControl/changeset/view/18277#347257

Application hosted at www.dotnetshoutout.com

Chad Moran
A: 

Quite surprised to see the NerdDinner routing file only has one custom route. Proof that if you follow convention that you can use the routing handler 'out of the box'.

namespace NerdDinner {

    public class MvcApplication : System.Web.HttpApplication {

        public void RegisterRoutes(RouteCollection routes) {

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

            routes.MapRoute(
                "UpcomingDinners", 
                "Dinners/Page/{page}", 
                new { controller = "Dinners", action = "Index" }
            );

            routes.MapRoute(
                "Default",                                              // Route name
                "{controller}/{action}/{id}",                           // URL with parameters
                new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
            );
        }

        void Application_Start() {
            RegisterRoutes(RouteTable.Routes);
        }
    }
}
Simon_Weaver
+1  A: 

Check here for mvc sample apps.

Arnis L.