views:

14

answers:

1

hi all, i have several AreaRegistration classes which one each registers own routes and each one have some duplicated elements such as bolded text in below:

context.MapRoute("Search", "**{culture}/{style}**/search",
                            new
                            {
                                **culture = cultureValue,
                                style = styleValue,**
                                controller = "search",
                                action = "default"
                            },
                            new
                            {
                                **culture = new CultureRouteConstraint(),
                                style = new StyleRouteConstraint()**
                            });

how i can have minimum AreaRegistrations with putting duplicated elements in single place which handles that? this is possible?

+1  A: 

You can add routes to the Global.asax file and use the area route value. For example:

routes.MapRoute("Search", "{culture}/{style}/search", new
                          {
                            culture = cultureValue,
                            style = styleValue,
                            controller = "search",
                            action = "default",
                            area = "areaName"
                          });
Shay Friedman
my means was that i add some duplicated in a container-like class and when each routes registered; two section merges together! i don't know this is possible or no!??! also i know that we can add routes i global.asax file; but my means was another ;)
Sadegh