I m using mvc4. I have urls like http://<mydomain>/<contoller0>/<action1> , http://<mydomain>/<contoller0>/<action2>,...
I want to show to the user only as http://<mydomain>/<contoller0>/{somepage} for all the actions in that particular controller.
How to impliment this in RouteConfig? I dont want to mess any requests to other controllers. Just want to do it for a specific controller and its actions.
How can I do it.

Currently my RoutConfig.cs look lik this.(It s the default)

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

            routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
Member Avatar for LastMitch

How to impliment this in RouteConfig? I dont want to mess any requests to other controllers. Just want to do it for a specific controller and its actions. How can I do it.

The question you ask is borderline between SEO URL friendly and URL rewrite so it's bit tircky how to approached this.

The reason is that you wants how to the user only and it seems you don't know where to start to make changes you can used this:

http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx

and try this:

http://www.hanselman.com/blog/IntroducingASPNETFriendlyUrlsCleanerURLsEasierRoutingAndMobileViewsForASPNETWebForms.aspx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.