title: Removing /Index from end of browser URL
body: <p>I'm a bit rusty on my MVC routing.</p>
  
  <p>I'm using a default route of</p>
  
  <pre><code>routes.MapRoute(
      "Default",
      "{controller}/{action}",
      new
      {
          controller = "Default",
          action = "Index",
      });
  </code></pre>
  
  <p>I have a controller:</p>
  
  <pre><code>public class SomeController : Controller
  {
      public async Task&lt;ActionResult&gt; Index()
  </code></pre>
  
  <p>So, typically, this can be hit with either <code>http://mydomain/Some/Index</code> -or- <code>http://mydomain/Some</code></p>
  
  <p>On this particular controller, I'd like to either deny (404) ~/Some/Index or simply redirect ~/Some/Index to ~/Some.</p>
  
  <p>This is relatively easy to accomplish in the controller:</p>
  
  <pre><code>public async Task&lt;ActionResult&gt; Index()
  {
      var p = Request.Url.Segments;
      var last = p.Last();
      if(string.Equals(last, "index", StringComparison.InvariantCultureIgnoreCase))
      {
          return RedirectToActionPermanent("Index");
      }
  </code></pre>
  
  <p>but now it seems like the controller is getting polluted by cross-cutting concerns. Is there a cleaner way?</p>