tags:

views:

44

answers:

1

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?

+1  A: 

I think you need to go through RouteData to access the routing parameters.

E.g.

Routedata.Values["id"]
Ola Herrdahl
THANK YOU SO MUCH! That's exactly what I was looking for. You can't imagine how important this is for building a multi tenancy app. Thanks again.
Alex