tags:

views:

44

answers:

1

This is what I'm trying to do. I have a route defined like below.

     <route name="productresultscatchall" url="ProductResults/{*querystring}" controller="ProductResults" action="Display"/>

My urls get constructed by a non-MVC page that has no idea about my routes. It passes in everything as a BIG querystring.

e.g.

www.abc.com/ProductResults/productid=249&categoryid=38&producttype=xyz&sorttype=1&showdesc=false

The querystring param combination can change and there is no way I can change the incoming url to a SEO-friendly route.

My end goal is to get every possible querystring param that is passed and use it (if available). What I do not want to do is create an Action method that accepts all combinations of parameters. The Action method will use a helper CurrentRoute.GetValue(paramName) to retrieve values.

Does MVC pass in the querystring parameters that can be accessed via the controller?

+1  A: 

AFAIK you can bind querystring parameters to controller method calls, like they were POST variables.

Edit: sorry, what you need is here: http://stackoverflow.com/questions/998389/how-can-i-access-the-entire-query-string-in-an-asp-net-controller-action

[BTW: nice Zen gravatar... :)]

rsenna
Hope I haven't made a fool out of myself. Hehehe. I think I should have rephrased my question to say 'If MVC had a built-in mechanism to supply query params in addition to the routedata'. What I'm basically trying to accomplish is a way for my team to access any param (querystring or a friendly one) via a helper. Looks like I will have to just abstract away access to the Request behind this helper. Thanks a bunch for the quick reply and the compliment :)
Praveen