title: ASP MCV: Index action with optional string parameter
body: <p>I would like to have an Index action with an optional string parameter. I'm unable to make it work.</p>
  
  <p>I need the following routes:</p>
  
  <pre><code>http://mysite/download
  http://mysite/download/4.1.54.28
  </code></pre>
  
  <p>The first route will send a null model to the Index view, and the second one will send an string with the version number.</p>
  
  <p>How can I define the route and the controller?</p>
  
  <p>This is my route definition:</p>
  
  <pre><code>routes.MapRoute(
      name: "Download",
      url: "Download/{version}",
      defaults: new { controller = "Download", action = "Index", version = UrlParameter.Optional }
  );
  
   routes.MapRoute(
      name: "Default",
      url: "{controller}/{action}/{id}",
      defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
  );
  </code></pre>
  
  <p>And this is the controller:</p>
  
  <pre><code>    public ActionResult Index(string version)
      {
          return View(version);
      }
  </code></pre>
  
  <p>Why does this not work? I'm not an expert in ASP MVC but this seems to be a very simple problem.</p>
  
  <h2>The error</h2>
  
  <ul>
  <li>When I go to <code>http://mysite/downloads</code> it works fine</li>
  <li>When I go to <code>http://mysite/downloads/4.5.6</code>, the controller is correctly called, and the parameter is correctly passed. But then seems that the view is not found. This is the error I found:</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/vBsXO.png" alt="enter image description here"></p>