title: Accessing ViewContext in Razor Helper
body: <p>I have a helper method like this:</p>
  
  <pre><code>@helper Message(Func&lt;object, object&gt; markup) {
      &lt;tr class="message"&gt;
          &lt;td width="100%" style="padding-bottom: 1em; color: #333333; font-size: 14px; line-height: 1.3"&gt;
              @markup.DynamicInvoke(this.ViewContext)
          &lt;/td&gt;
      &lt;/tr&gt;
  }
  </code></pre>
  
  <p>that I call with razor markup, for example:</p>
  
  <pre><code>@&lt;text&gt;
      We are writing to let you know that @ViewBag.HostName has canceled @ViewBag.TripName and we've removed the trip from your My Trips page.
      &lt;br /&gt;
      &lt;br /&gt;
      To plan a new trip, go back to Travefy
      &lt;br /&gt;
  &lt;/text&gt;
  </code></pre>
  
  <p>However, I don't know the syntax to get the page's <code>ViewContext</code>, because while in an example I saw <code>this.ViewContext</code>, <code>this</code> does not exist in the helper. Any ideas where I can access it?</p>