views:

59

answers:

1

Hi,
I am building a simple web site for a client and this is my first time with ASP.Net Mvc. For the production i need to use MVC 1.0 and the most efficient way to saparate Admin logic from the rest of this site is using Areas.

The fact that i couldnt use MVC 2, so i have used the Haacks area prototype and everything was ok.

I want to write a custom routing for paging results but i couldnt get it done.

    routes.MapAreas("{controller}/{action}/{id}",
                    "Adore.Web",
                    new[] { "Admin" });

               //my custom routing
                routes.MapRoute(
                   "PagingServices",
                   "Admin/Services/{pageNumber}",
                   new { area = "Admin", controller = "Services", action = "Index" });

                routes.MapRootArea("{controller}/{action}/{id}",
                    "Adore.Web",
                    new { controller = "Home", action = "Index", id = "" });

As you see above i am trying to get this "Admin/Services/1" but couldnt figure it out.

How can i do it, thanks in advance !

+3  A: 

Have you tried Phil Haack's Routing Debugger? :) http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx

That might help.

Also, it looks like the problem might be that your first route is going to match anything starting with /Admin. Try moving your custom route to the top since routes are evaluated in order.

Haacked
Hi Haacked :) of course i ve tried your debugger and thanks for this great tool. Ok i will try moving the custom route to the top.Thanks again
Barbaros Alp
It worked! thank you so much
Barbaros Alp