title: Get Relative Path from Route Name
body: <p>When a path is named...</p>
  
  <pre><code>[Route("api/[controller]/{id}/Existing", Name = "ExistingOrdersLink")]
  public class OrdersController : Controller {...}
  </code></pre>
  
  <p>...it is easy to create an <strong>absolute</strong> path using its name:</p>
  
  <pre><code>var address = Url.Link("ExistingOrdersLink", new { id = 22 });
  </code></pre>
  
  <p>However, I need the ability to generate a <strong>relative</strong> path from a Route name.  So I write code like this:</p>
  
  <pre><code>//Is there a built-in mechanism for this?
  string partial = new Uri(Url.Link("ExistingOrdersLink", new { id = id })).PathAndQuery;
  </code></pre>
  
  <p>The above works but, in ASP.NET Core, is there a more direct way to get the same result?</p>
  
  <h2>Context</h2>
  
  <p>Why do I need this?  Some of the controllers I make are actually generic:</p>
  
  <pre><code>[Route("api/Subscribers/{id}/[controller]", "SubscriberLink")]
  [Route("api/Organization/{id}/[controller]", "OrganizationLink")]
  public class OrdersController&lt;T&gt; : Controller where T : IOrder
  {
      private ICommand&lt;Order&lt;T&gt;&gt; createOrder;
  
      protected OrdersController(ICommand&lt;Order&lt;T&gt;&gt; createOrder)
      {
          this.createOrder = createOrder;
      }
  
      [HttpPost("{otype}")]
      public async Task&lt;IActionResult&gt; Create(
          Guid id,
          [FromBody] Order&lt;T&gt; order)
      {
          order.CustomerOrderId = Guid.NewGuid();
          createOrder.Handle(order);
  
          string[] segs = Request.Path.Value.Split(new char[] { '/' },StringSplitOptions.RemoveEmptyEntries);
  
          //This will become either "SubscriberLink" or "OrganizationLink"
          string route = $"{segs[1]}Link";
  
          //Is there a built-in mechanism for this?
          string partial = new Uri(Url.Link(route, new { id = id })).PathAndQuery;
  
          partial = $"{partial}/{order.CustomerOrderId}";
          CreatedResult reply = Created(partial, null);
  
          return reply;
      }
  }
  </code></pre>