Skip to content

Instantly share code, notes, and snippets.

@satish860
Forked from benfoster/gist:3635064
Created September 5, 2012 11:23
Show Gist options
  • Save satish860/3635254 to your computer and use it in GitHub Desktop.
Save satish860/3635254 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, "/");
requestMessage .Properties[HttpPropertyKeys.HttpConfigurationKey] = config ;
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