title: MVC Routes within WebAPI controller
body: <p>Quick question regarding routes within MVC and WebAPI. I have added a route to route config.cs:</p>
  
  <pre><code>        routes.MapRoute(
              name: "ConfirmEmail",
              url: "ConfirmEmail/{userid}",
              defaults: new { controller = "Email", action = "ConfirmEmail" }
          );
  </code></pre>
  
  <p>This is registered in the global.asax as per normal:</p>
  
  <pre><code>RouteConfig.RegisterRoutes(RouteTable.Routes);
  </code></pre>
  
  <p>I am trying to generate a URL for use within an email which is sent as part of a function call within a WebAPI controller function. I am using the UrlHelper.Link function to attempt to generate a URL, however I receive an error saying the route cannot be found by name:</p>
  
  <pre><code>var url = Url.Link("ConfirmEmail", new { userid = "someUserId" });
  </code></pre>
  
  <p>Now I was under the impression route dictionaries were shared in both MVC and WebAPI controller contexts however I cannot see the MVC routes within the route dictionary of the incoming Web API call (on the Request object) however the WebAPI routes I have defined are there.</p>
  
  <p>Am I missing something?</p>