Try our conversational search powered by Generative AI!

MVC Route from Gadget

Vote:
 

I have this url in my system http://localhost:17007/modules/EpiCase/Config/Index and I wanna change to http://localhost:17007/EpiCase/Config/Index .

I tried add a route on the resgister routes, look like this.

routes.MapRoute(
  name: "EPiCase_Default",
  url: "EPiCase/{controller}/{action}/{id}", 
  defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);

 

And I call RegisterRoutes on InitializationModule but when I try go to http://localhost:17007/EpiCase/Config/Index I get 404 erro.

 

#81815
Feb 27, 2014 3:51
Vote:
 

It could be either that "wrong" route handles the request, no route handles the request or that the controller cant be found. To determine which case it is you could have a break point that get a hit on the request. You could e.g. add a method for Application_BeginRequest and there query RouteTable.Routes.GetRuteData with HttpContext.Current. Then you would see if any route handles the request and if so which.

An alternative to having the breakpoin is to use Developer Tool AddOn http://world.episerver.com/Blogs/Shahram-Shahinzadeh/Dates/2013/12/EPiServer-Developer-Tool/ where you can type in a url and see which routes that matches.

#81824
Feb 27, 2014 9:25
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.