title: Redirected View not displaying "active" attribute in MVC application
body: <p>I have a new MVC 4 application that I am playing with.  Basically, a few menu items across the top, with the currently active page being highlighted with the follow JavaScript in my <code>_Layout.cshtml</code>:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function () {
          $('#top-navbar .nav a[href="' + this.location.pathname + '"]').parent().addClass('active');
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>That works great when navigating via the menu across the top.  However, I am adding a "login" ability, and if the user tries to go back to the login page after they are already logged in, it will simply send them the <code>Index</code> view instead of the <code>Login</code> view.  The problem is, the CSS is still highlighting the <code>Login</code> button in the menu, rather than the <code>Home</code> button.</p>
  
  <p>I am persisting the user's login information via the <code>Session</code> state.  Here is the <code>Login()</code> <code>ActionResult</code>:</p>
  
  <pre><code>[HttpGet]
  public ActionResult Login()
  {
      if (Session["ContactName"] != null)
      {
          return View("Index");
      }
      else
      {
          return View();
      }
  }
  </code></pre>
  
  <p>As you can see, if the <code>ContactName</code> is not <code>null</code> then they are already logged in, so it sends them the <code>Home</code> view.  Should I instead <code>Redirect()</code> to the main page?</p>
  
  <p>Also, here is the menu <code>navbar</code> if needed:</p>
  
  <pre><code>&lt;ul class="nav navbar-nav"&gt;
      &lt;li&gt;@Html.ActionLink("Home", "Index", "Home")&lt;/li&gt;
      &lt;li&gt;@Html.ActionLink("About Us", "About", "Home")&lt;/li&gt;
      &lt;li&gt;@Html.ActionLink("Customer Login", "Login", "Home")&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>