views:

29

answers:

1

My route looks like:

  routes.Add(new Route("{companyName}/{action}/{id}", new MvcRouteHandler())
   {
     Defaults = new RouteValueDictionary(new { controller = "CompanyController", action = "Index", id = 1 }),
   }   
   );

my action:

  public ActionResult Index(string companyName, string id)
  {
         Response.Write(companyName);
         Response.End();

         return ViePage("~/views/company/index.aspx");
  }
+2  A: 

try this:

 routes.Add(new Route("{companyName}/{action}/{id}", new MvcRouteHandler())
   {
     Defaults = new RouteValueDictionary(new { controller = "Company", action = "Index", id = 1 }),
   }   
   );

when referencing your controllers you don't want to have the "controller" part of the name there.

Patricia
You also don't have to specify the actual file path of the view page. The MVC framework will find the view that matches View/{Controller}/{Action}
scottm
Good Point Scott! also. ViePage isn't going to go to far. but that's probably just a typo in the post :)
Patricia
ah, added the controller to the end, thanks Patricia!
mrblah