rewrite routes for URl

Posted by user348173 on Stack Overflow See other posts from Stack Overflow or by user348173
Published on 2012-03-26T05:21:31Z Indexed on 2012/03/26 5:29 UTC
Read the original article Hit count: 157

Filed under:

I have the following URl:

http://localhost:12981/BaseEvent/EventOverview/12?type=Film

This is route:

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

I want that in a browser the url looks like:

http://localhost:12981/Film/Overview/12

How can I do this?

One more example:

http://localhost:12981/BaseEvent/EventOverview/15?type=Sport

should be

http://localhost:12981/Sport/Overview/15

Thanks.

© Stack Overflow or respective owner

Related posts about asp.net-mvc-routing