title: .net mvc route default controller/action but not default parameters
body: <p>I created this route</p>
  
  <pre><code>          routes.MapRoute( 
                  name: "Survey", 
                  url: "{controller}/{action}/{surveyid}/{userid}/{hash}", 
                  defaults: new { controller = "Home", action = "Survey" }, 
                  constraints: new { surveyid = @"\d+", userid = @"\d+" } 
             );
  </code></pre>
  
  <p>When I then browse to </p>
  
  <pre><code>http://localhost:3086/Home/Survey/1/1/3r2ytg
  </code></pre>
  
  <p>It works, however if I browse to</p>
  
  <pre><code>http://localhost:3086/1/1/3r2ytg
  </code></pre>
  
  <p>it does not work.</p>
  
  <p>If I then changed the route like so</p>
  
  <pre><code>        routes.MapRoute(
              name: "Survey",
              url: "{surveyid}/{userid}/{hash}",
              defaults: new { controller = "Home", action = "Survey" },
              constraints: new { surveyid = @"\d+", userid = @"\d+" }
          );
  </code></pre>
  
  <p>The exact opposite would work (and that makes sense).</p>
  
  <p>But I am curious with the first route i thought both URLs should work since it shoudl grab the default controller and action when none is given.</p>
  
  <p><strong>Update</strong></p>
  
  <p>In the end I went with only this</p>
  
  <pre><code>        routes.MapRoute(
              name: "Survey",
              url: "{surveyId}/{userId}/{hash}",
              defaults: new { controller = "Home", action = "Survey" },
              constraints: new { surveyId = @"\d+", userId = @"\d+" }
          );
  </code></pre>
  
  <p>as that is the behavior I wanted. However when I then call</p>
  
  <pre><code>@Url.Action("Survey", "Home", new 
  { 
      userId = @Model.UserId, 
      surveyId = survey.Id, 
      hash = HashHelpers.CreateShortenedUrlSafeHash(@Model.SecretString + survey.Id.ToString() + @Model.UserId.ToString())
  })
  </code></pre>
  
  <p>It generates </p>
  
  <pre><code>/Admin/Home/Survey?userId=25&amp;surveyId=19&amp;hash=2Norc
  </code></pre>
  
  <p>instead of a shiny path. I can force it with Url.RouteUrl but I thought it should have picked this one automatically.</p>