title: MVC routing with multiple parameter with different parameter name
body: <p>In my home controller, I have 3 Action methods. 
  which is give below.</p>
  
  <pre><code>        public ActionResult Index(int id)
          {
              return View();
          }
  
  
          public ActionResult Index2(int did,int docType)
          {
              return View();
          }
  
  
          public ActionResult Index3(int uid,int docId,int typeId)
          {
              return View();
          }
  </code></pre>
  
  <p>As I had given diffrent parameter name in each action methods so I have to change in <code>Route.config</code>.</p>
  
  <p>I have Done this</p>
  
  <p><strong>Method  1</strong></p>
  
  <pre><code>routes.MapRoute(
                  name: "Home",
                  url: "{controller}/{action}/{did}/{docType}",
                  defaults: new { controller = "Home", action = "Index2", did = UrlParameter.Optional, docType = UrlParameter.Optional }
              );
              routes.MapRoute(
                  name: "Home",
                  url: "{controller}/{action}/{uid}/{docId}/{typeId}",
                  defaults: new { controller = "Home", action = "Index3", uid = UrlParameter.Optional, docId = UrlParameter.Optional, typeId = UrlParameter.Optional }
              );
              routes.MapRoute(
                  name: "Default",
                  url: "{controller}/{action}/{id}",
                  defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
              );
  </code></pre>
  
  <p>but it is giving me exception like</p>
  
  <pre><code>Home' is already in the route collection. Route names must be unique
  </code></pre>
  
  <p>So I have change it to like this</p>
  
  <p><strong>Method 2</strong></p>
  
  <pre><code> routes.MapRoute(
              name: "Default",
              url: "{controller}/{action}/{id}/{did}/{docType}/{uid}/{docId}/{typeId}",
              defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional, did = UrlParameter.Optional, docType = UrlParameter.Optional, uid = UrlParameter.Optional, docId = UrlParameter.Optional, typeId = UrlParameter.Optional }
          );
  </code></pre>
  
  <p>When I hit Url like</p>
  
  <p><a href="http://localhost:50958/Home/Index/2" rel="nofollow">http://localhost:50958/Home/Index/2</a></p>
  
  <p><a href="http://localhost:50958/Home/Index2/2/3" rel="nofollow">http://localhost:50958/Home/Index2/2/3</a></p>
  
  <p><a href="http://localhost:50958/Home/Index3/2/3/4" rel="nofollow">http://localhost:50958/Home/Index3/2/3/4</a></p>
  
  <p>it throwing me exception. </p>
  
  <p><strong>This is Solution.</strong></p>
  
  <p>As suggested by Stephen Muecke</p>
  
  <pre><code> routes.MapRoute(
                  name: "Admin",
                  url: "{controller}/{action}/{did}/{docType}",
                  defaults: new { controller = "Home", action = "Index2", did = UrlParameter.Optional, docType = UrlParameter.Optional }
              );
              routes.MapRoute(
                  name: "User",
                  url: "{controller}/{action}/{uid}/{docId}/{typeId}",
                  defaults: new { controller = "Home", action = "Index3", uid = UrlParameter.Optional, docId = UrlParameter.Optional, typeId = UrlParameter.Optional }
              );
              routes.MapRoute(
                  name: "Default",
                  url: "{controller}/{action}/{id}",
                  defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
              );
  </code></pre>