routes.MapRoute

 routes.MapRoute(
                "Default",
                "{controller}/{action}/{id}",
                new { action = "Index", id = "0" },
                new { controller = @"^\w+", action = @"^\w+", id = @"^\d+" });

            // Archive/2008-05-07
            routes.MapRoute(
                "BlogArchive",
                "Archive/{date}",
                new { controller = "Blog", action = "Archive" },
                new { date = @"^\d{4}-\d{2}-\d{2}" });

            // Car/bmw.abc
            routes.MapRoute(
                "Car",
                "Car/{make}.{model}",
                new { controller = "Car", action = "Index" },
                new { make = @"(acural|bmw)" });

            //必须是提交post url直接回车是get
            routes.MapRoute(
                "Book",
                "Book/Add/{name}",
                new { controller = "Book", action = "Add" },
                new { httpMethod = "POST" });

            //后面所有东西都捕获
            routes.MapRoute(
                "CatchIt",
                "Product/{*values}",
                new { controller = "Product", action = "Index" });

posted @ 2009-09-21 07:27  xumingming  阅读(4118)  评论(0编辑  收藏  举报