title: How do I call Url.Action from an HtmlHelper class?
body: <p>I've used</p>
  
  <pre><code>Url.Action("actionFoo", "controllerBar")
  </code></pre>
  
  <p>in my Views (aspx).  But now I'm refactoring some of my markup to an HtmlHelper I've created.</p>
  
  <p>Problem is I don't seem to have the proper namespaces included or the View has some default object reference that I'm not aware of.  Point is the compiler can't find Url.Action.</p>
  
  <p>For simplicity sake here is what I'm trying to do...</p>
  
  <pre><code>public static MvcHtmlString RenderActionButtons(this HtmlHelper helper, string actionName, string controllerName)
  {
      TagBuilder customActionButtonTagBuilder = new TagBuilder("a");
      customActionButtonTagBuilder.Attributes.Add(new KeyValuePair&lt;string, string&gt;("href", Url.Action(actionName, controllerName)));
      customActionButtonTagBuilder.InnerHtml = "foo";
      customActionButtonTagBuilder.AddCssClass("custom-action-button");
  
      return MvcHtmlString.Create(customActionButtonTagBuilder.ToString(TagRenderMode.Normal));
  }
  </code></pre>
  
  <p>How do I point my code to the proper usage of Url.Action?</p>