title: Razor - write unique tag into <body>
body: <p>I am follwing this dom-based routing for kicking off specific javascript on each page
  <a href="http://viget.com/inspire/extending-paul-irishs-comprehensive-dom-ready-execution" rel="nofollow">http://viget.com/inspire/extending-paul-irishs-comprehensive-dom-ready-execution</a> </p>
  
  <p>So need to write a unique data attribute into the  tag each time a page loads</p>
  
  <p>e.g. </p>
  
  <pre><code>&lt;body data-controller="Home" data-action="Index"&gt;
  </code></pre>
  
  <p>What's the best place to put this logic for a razor view?</p>
  
  <p>The body tag is in my masterpage (_layout.cshtml) file. And it needs to dynamically render that on each page</p>
  
  <p>Was thinking of overriding OnActionExecuting in a base controller and have that inject the current controller and action name into the ViewBag. Then referencing the ViewBag properties in my _layout.cshtml </p>
  
  <p>Does that make sense or is there a more appropriate place for this functionality?</p>