I’m working on an application that will potentially have very long query strings to maintain state.
I’m not sure what the best way to handle these long query strings in the action methods, since I will end up with a very long list of parameters.
Is it best to access the query string parameters directly from the request object or should I go ahead and create an action method with a very long parameter list?
i.e. a number a configuration parameters need to be passed in to customise the page. so we might have a query string as such: ?rid=123&bid=456&cid=789&did=aaa&bg=333&f=999&…..
public ActionResult AvailableTimes(int rid, int bid, int cid, string did, string bg, string f......)
{
// Do stuff
}
or
public ActionResult AvailableTimes()
{
var query = Request.Query;
// Do stuff
}
Thanks in advance.
Create an class that contains all parameters of your query string. Then in your action result, use the object instead of all the parameters.