title: How do I only display methods that belong to a controller specified by the URL
body: <p>I am working on customizing the ASP.NET Web API help pages.</p>
  
  <p>I am looking for the best approach to display methods that belong to a controller specified by the URL.  My controllers are all prefixed with "<strong>ws_</strong>".  </p>
  
  <p>I have added an entry to my RouteConfig to recognize URLs containing the string "<strong>ws_</strong>" as follows:</p>
  
  <pre><code>public class RouteConfig
  {
      public static void RegisterRoutes(RouteCollection routes)
      {
          routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  
          routes.MapRoute(
              name: "WSContext",
              url: "ws_{webservice}",
              defaults: new { controller = "Help", action = "WsContext" }
          );
  
          var route = routes.MapRoute(
              name: "Default",
              url: "{controller}/{action}/{id}",
              defaults: new { controller = "Help", action = "Index", id = UrlParameter.Optional }
          );
  
          route.DataTokens["area"] = "HelpPage";
      }
  }
  </code></pre>
  
  <p>Here is my HelpController.  I'm trying to get the WsContext method to strip out methods that do not belong to the controller (i.e. <strong>ws_testController</strong>) passed via the URL (i.e. <strong>mysite.com/ws_test</strong>).  </p>
  
  <pre><code>public class HelpController : Controller
  {
      public HttpConfiguration Configuration { get; private set; }
      private Collection&lt;ApiDescription&gt; apiDescriptionCollection;
  
      public HelpController()
          : this(GlobalConfiguration.Configuration)
      {
      }
  
      public HelpController(HttpConfiguration config)
      {
          Configuration = config;
          this.apiDescriptionCollection = Configuration.Services.GetApiExplorer().ApiDescriptions;
      }        
  
      public ActionResult Index()
      {
          ViewBag.DocumentationProvider = Configuration.Services.GetDocumentationProvider();
          return View(this.apiDescriptionCollection);
      }
  
      public ActionResult WsContext(string webservice)
      {
          ViewBag.DocumentationProvider = Configuration.Services.GetDocumentationProvider();
          Collection&lt;ApiDescription&gt; apiCollection = new Collection&lt;ApiDescription&gt;();
          foreach (ApiDescription desc in this.apiDescriptionCollection)
          {
              if (desc.GetControllerName() == ("ws_" + webservice))
                  apiCollection.Add(desc);                
          }
          if (apiCollection.Count &gt; 0)
              this.apiDescriptionCollection = apiCollection;
          return RedirectToAction("Index");
      }
  ...
  }
  </code></pre>
  
  <p>I am currently receiving the following error:</p>
  
  <blockquote>
    <p>No route in the route table matches the supplied values.</p>
  </blockquote>