Skip to content

Instantly share code, notes, and snippets.

@benfoster
Created September 5, 2012 11:05
Show Gist options
  • Save benfoster/3635064 to your computer and use it in GitHub Desktop.
Save benfoster/3635064 to your computer and use it in GitHub Desktop.
Testing route generation
var config = new HttpConfiguration();
config.Routes.MapHttpRoute("Foo", "foo/{id}", new { controller = "foo" });
config.Routes.MapHttpRoute("Bar", "bar/{id}", new { controller = "bar" });
var requestMessage = new HttpRequestMessage(HttpMethod.Get, "/");
var vp = config.Routes.GetVirtualPath(requestMessage, "Foo" , new Dictionary<string,object> { { "controller", "foo" }, { "id", 10 } });
Console.WriteLine(vp);
Console.ReadLine();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment