views:

12

answers:

1

routes.MapRoute( "Route", "{id}/{*seostuff}", new {controller = "Home", action="Index", seo = UrlParameter.Optional});

that will allow you to map urls such as http://www.somesite.com/11/whatever/goes-here/will-be-whatever-you/want

Here is the original post http://stackoverflow.com/questions/3304645/asp-net-mvc-custom-routing

Hi guys!

-what I want to know is how can this be code in controller? I have a static page like this Product/Phone/i-phone.aspx which is under the product it has a folder phone.. . any suggestion guys? thank you very much.. .

A: 

You can define the route you have described...

        routes.MapRoute(
            "Route", // ShopsToRent/0/B31 5EH/9/0/0/0/0/0
            "{id}/{seo}", // URL with parameters
            new
            {
                controller = "ControllerName",
                action = "ActionName",
                page = UrlParameter.Optional,
                title = ""
            } // Parameter defaults
        );

I personally prefer to have a Keyword at the start of the url as this gives you an additional keyword (eg www.keywords.com/keywords )and allows future additions to the site...

        routes.MapRoute(
            "Route", // ShopsToRent/0/B31 5EH/9/0/0/0/0/0
            "KEYWORD/{id}/{seo}", // URL with parameters
            new
            {
                controller = "ControllerName",
                action = "ActionName",
                page = UrlParameter.Optional,
                title = ""
            } // Parameter defaults
        );
Desiny