In MVC, should pagination info go in the path or querystring?
model-view-controller, pagination, path, query-string
Solution
I prefer things like pagenumbers to be in the querystring variables. I think there's a difference in descriptiveness between
http://mydomain.com/books/thriller?pagesize=50&page=4
and
http://mydomain.com/books/thriller/50/4
The point (to me) of having clean url's is for them to be more descriptive and readable, and I find the first example to be just that.
One interesting point made byJohnRudolfLewis is:
One rule of thumb that I follow is that if the argument is required, consider using the path, if the argument is optional, always use querystring arguments.
Problem
In the path: Format: http://mydomain.com/{category}/{subcategory}/{pageNumber}/{pageSize} Example: http://mydomain.com/books/thriller/3/25 In the querystring: Format: http://mydomain.com/{category}/{subcategory}? pageNumber={pageNumber}&pageSize={pageSize} Example: http://mydomain.com/books/thriller?pageNumber=3&pageSize=25 I like having everything on the path, but my problem with that is that while it is obvious (or at least somewhat obvious) what "books" and "thriller" are in first example, the "3" and "25" seem pretty arbitrary by contrast. Is there a canonical method for determining what goes where in MVC, or is it really just up to the dev?