title: ASP.NET MVC Dynamic Routes and Action Links with Arbitrary Depth
body: <p>I'd like to put together a forum/message board with ASP.NET MVC.  Pretty common on these types of forums are hierarchical board categories, so for instance:</p>
  
  <p>-General Discussion<br />
  -Technical Support<br />
  --Website Technical support<br />
  --Product Technical Support<br />
  ---Product A Technical Support<br />
  ---Product B Technical Support</p>
  
  <p>Below each category are then topics and messages belong to those topics.  What I'm primarily concerned with is 1.) getting to the correct place, given a URL, 2.) not including boatloads of unnecessary information in my URL, and 3.) being able to recreate a URL from code.</p>
  
  <p>I'd like a URL to be something like this:</p>
  
  <pre>
  mysite.com/Forum/ - forum index
  mysite.com/Forum/General-Discussion/ - board index of "general discussion" 
  mysite.com/Forum/Technical-Support/Product/Product-A/ - board index of "Product A Tech Support"
  mysite.com/Forum/Technical-Support/Website/Topic1004/ - Topic index of topic with ID 1004 in the "Website Technical Support" board
  mysite.com/Forum/Technical-Support/Website/Topic1004/3 - Page 3 of Topic with ID 1004
  </pre>
  
  <p>Now, I've excluded Action names from this because they can be inferred based on where I am.  Each Board entity in my database has a "UrlPart" column, which is indexed, so I expect to be able to do relatively fast queries against that table to figure out where I am.</p>
  
  <p>The question is: in order to figure out the correct place, should I use a custom route handler, a custom route binder, or should I just create obscure routing rules?</p>
  
  <p>This suggestion looks pretty good but it also looks like a lot of work for little benefit:
  <a href="https://stackoverflow.com/questions/379558/mvcnet-routing#379823">ASP.NET MVC custom routing for search</a></p>
  
  <p>This seems to indicate that creating a model binding would be easier:
  <a href="https://stackoverflow.com/questions/296284/mvc-dynamic-routes">MVC Dynamic Routes</a></p>
  
  <p>To fulfill #3 I'm going to have to create my own custom URL generation logic, right?</p>