Global.asax Route Values
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional, filterDate = DateTime.Now.AddDays(-1), filterLevel = "INFO" }
);
Here is my actionlink
@Html.ActionLink(item.MachineName, "Machine", new { id = item.MachineName, filterLevel = "hello" }, null)
When the filter level is specified in the actionlink, it generates a URL similar to this:
http://localhost:1781/LoggingDashboard/log/level/VERBOSE
This is the same page I'm on now. If I change the actionlink to use a property other than the default value in the route table (yes, if I use filterDate, it will go bad too), it generates a link like this:
@Html.ActionLink(item.MachineName, "Machine", new { id = item.MachineName, foo = "bar" }, null)
http:
Is this behavior right? Should I not override the default settings set in the route table? I confirmed that if I remove the default filterLevel value from the route table, this works the way I expect:
http://localhost:1781/LoggingDashboard/log/Machine/C0UPSMON1?filterLevel=VERBOSE
--- EDIT --- sorry, here is the action
public ActionResult Machine(string id, DateTime filterDate, string filterLevel)
{
...
var model = new LogListViewModel { LogEntries = logEntries };
return View(model);
}
, , global.asax. filterLevel filterDate.