A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

Define custom route to hide the action name from page url

Vote:
 

Hi, I need a help with creating custom routes in episerver7.

My route definition in MVC would look something like this:

routes.MapRoute(

            "ListingPageRoute",

            "{controller}/{page}",

            new { controller = "ListingPage", action = "Index", page = UrlParameter.Optional }

        );

What I want to achieve is just not to show “Index” as action name in page url for the Index action of ListingPageController. So, in MVC routing logic, instead of www.mysite.com/listingpage/index/2 my custom url should be: www.mysite.com/listingpage/2

My default route mapping for episerver is:

var segments = "{language}/{node}/{action}/{page}";

var defaults = new { action = "Index", page = 1 };

I understand that I have to change this episerver custom route definition, but everithing I try give me 404 error.

Please help, thanks :)

#65407
Jan 29, 2013 11:25
Vote:
 

Guys, can anybody help me with this routing problem?

#65534
Jan 31, 2013 17:26
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.