Tanvir Hussain
Tanvir Hussain

Reputation: 3

Routing table is not working

HI I have the following routing table

routes.MapRoute(null,
    "Save", // Route name               
    new { controller = "Package", action = "Save"} // Parameter defaults
);

routes.MapRoute(
    "Package", // Route name
    "{controller}/{action}/{name}/{p}", // URL with parameters               
    new { controller = "Package", action = "Index", name = UrlParameter.Optional, p = UrlParameter.Optional } // Parameter defaults
);

routes.MapRoute(
    "Default", // Route name
    "{controller}/{action}/{id}", // URL with parameters               
    new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);

When i am typing the path /Package/Save it is showing me page not found.

Can anybody please tell me what i am doing wrong?

THanks

Upvotes: 0

Views: 305

Answers (1)

The first route is configured incorrectly - name of route, then the pattern and then the defaults.

Also make sure you have a Package controller and a Save action method on it.

Upvotes: 2

Related Questions