Question

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");
  }
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top