title: Why can't I access RouteData outside of Controller actions?
body: <p>I'm trying to access the ID created in RouteConfig in my HomeController using</p>
  
  <pre><code>var id = RouteData.Values["id"];
  </code></pre>
  
  <p>However, this line of code doesn't work outside of an action. Why is this? I can't even define publicly id and then initialise it in the action.</p>
  
  <p>Is there a significant reason as to why I can't do this? If not, is there a way to do it?</p>
  
  <p>Thanks!</p>