views:

28

answers:

1

If:

http://mySite/Users/9055 

returns a db record where UserID=9055 (via the userController.getUserID method)

And:

http://mySite/Users/Smith 

returns the same record via the userController.getUserName method

Isn't it reasonable to code a controller method that parses the either input?

Seems like a great option to users - the url as a means of navigating - as long as the top-level (controller) is broad yet focused enough (Users, Products, Billing, Reports) how do we parse for (so we can search on) any of several different datatypes?

thx

+4  A: 

you can have a string parameter for controller's action and then do int.TryParse to check if it is integer. if not assume that it is string

Andrey