Reputation: 36161
Let's say I have the following rule
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
And in the controller
public ActionResult Forums(int id)
{
Response.Write(id); // works
Response.Write(Request.QueryString["id"]); // doesn't
return View();
}
How can I get it with Request.QueryString?
Upvotes: 1
Views: 10874
Reputation: 4296
I think you need to go through RouteData to access the routing parameters.
E.g.
Routedata.Values["id"]
Upvotes: 6