Cache list of ids to check before querying database <p>I have a Asp.Net Mvc application that has a default route pattern of <code>/controller/action/id</code>. </p> <p>This means the user could simply put any ID in the url if they are savy enough to figure it out. I could handle the exceptions, redirect the user to an error page (and I am) or any number of other solutions. There are only about 1200 possible valid IDs. I was considering caching a list of these IDs at the application level to check against before querying the database to save the expense of making a connection and handling the exceptions.</p> <p>Does anyone have a good argument as to why this is a bad solution?</p>