In my web app. i want to setup a route like this:
/document/quality/index
/document/general/index
/document/quality/detail/[id]
/document/general/detail/[id]
As you can see i have two kind of documents: general and quality. What is the best way to set this up in my global.asax file? I tried the following, but i don't get it work:
routes.MapRoute(
"QualityDocument",
"Document/Quality/{action}/{id}",
new { controller = "Document", action="Index", id= ""}
);
routes.MapRoute(
"GeneralDocument",
"Document/General/{action}/{id}",
new { controller = "Document", action = "Index", id = "" }
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
EDIT
I have it working right now, but when i change the action="" in my asax file it doesn't work anymore:
Global.asax:
routes.MapRoute(
"GeneralDocument",
"Document/General/{action}/{id}",
new { controller = "Document", action = "blaat", id = "" }
);
DocumentController:
public void blaat(int? id)
{
Response.Write("algemeen");
// return View();
}
Now i get the Resource not found error. But when I use index instead of blaat it is working. How come?