title: MVC 5 Razor Navigation Active CLass
body: <p>I am trying to get the active class to show on my navigation.  I have written the htmlhelper:</p>
  
  <pre><code>public static string IsActive(this HtmlHelper htmlHelper, string controller, string action)
      {
          var routeData = htmlHelper.ViewContext.RouteData;
  
          var routeAction = routeData.Values["action"].ToString();
          var routeController = routeData.Values["controller"].ToString();
  
          var returnActive = (controller == routeController &amp;&amp; action == routeAction);
  
          return returnActive ? "active" : "";
      }
  </code></pre>
  
  <p>and this is my navigation:</p>
  
  <pre><code>&lt;li @Html.IsActive("MemberDashboard", "Index")&gt;&lt;a href="@Url.Action("Index", "MemberDashboard")"&gt;&lt;span class="fa fa-list-alt fa-lg fa-fw"&gt;&lt;/span&gt; Accounts&lt;/a&gt;&lt;/li&gt;
   &lt;li @Html.IsActive("Transfer", "Index")&gt;&lt;a href="@Url.Action("Index", "Transfer")"&gt;&lt;span class="fa fa-retweet fa-lg fa-fw"&gt;&lt;/span&gt; Transfers&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  
  <p>The navigation doesn't go to active when I'm on said page.</p>