Inconsistent Routing Results in MVC
        Posted  
        
            by 
                HapiDjus
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by HapiDjus
        
        
        
        Published on 2011-01-12T21:50:39Z
        Indexed on 
            2011/01/12
            21:53 UTC
        
        
        Read the original article
        Hit count: 245
        
asp.net-mvc-2
|routing
Seems I'm still missing something to the MVC routing concept. I have a route that follows nearly the same pattern as another route in an area but for what ever reason I get a 404 every time I attempt to run it. I've tried to use Phil Haack's Route Tester DLL and according to that it hits the correct route (matched route comes out to common/itemhistory/{contentid}). When I try to run it for real, it blows up.
I'm trying to map a call to a JsonResult by passing a Guid. I've had success with other routes working fine (common is an area in my site).
What could I be doing wrong?
       context.MapRoute(
            "ItemHistory",
            "common/itemhistory/{contentid}",
            new { controller = "common", action = "GetItemHistory" },
            new { contentid = @"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$" }
        );
        context.MapRoute(
            "Common_default",
            "common/{action}",
            new { controller="common", action = "Index" }
        );
© Stack Overflow or respective owner