Click here to Skip to main content
15,908,013 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
In the following code when i access "http://localhost:1904/Customer/New" it gives me an error as resource cannot be found. but if i comment all routs apart "DataEntry" it lands me on the specific page. Please help me out of this problem.

public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

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


routes.MapRoute(
name: "Home1",
url: "{controller}/{action}/{id}",
defaults: new { controller = "", action = "GotoHome", id = UrlParameter.Optional }
);

routes.MapRoute(
name: "DataEntry",
url: "Customer/New",
defaults: new { controller = "NewCustomerDataEntry", action = "NewCustomerDataEntry", id = UrlParameter.Optional }
);

routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
Posted
Comments
Sreekanth Mothukuru 27-Jun-15 8:46am    
Why there is no default controller for "Home1" route

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900