What's the best way to handle a visitor constructing their own URL and replacing what we expect to be an ID with anything they like?
For example:
http://stackoverflow.com/questions/236349
But the user could just as easily replace the URL with:
http://stackoverflow.com/questions/foo
I've thought of making every Controller Function parameter a String
, and using Integer.TryParse()
on them - if that passes then I have an ID and can continue, otherwise I can redirect the user to an Unknown / not-found or index View.
Stack Overflow handles it nicely, and I'd like to too - how do you do it, or what would you suggest?