Something as below - using RouteBase.
RouteData rd = new RouteData(this, new MvcRouteHandler());
rd.Values.Add("controller", controllername);
rd.Values.Add("action", actionname);
rd.Values.Add("url", url);
return rd
url-manipulation-implementing-routebase
EDIT
You can use url-routing-debugger to QUERY routable .. to see which registered route matches my url-string
use Nuget Package Manager Console - install-package routedebugger
you can query RouteCollection. partial basic code as below
in
protected void Application_Start()
{
RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);
and
public static class RouteDebugger
{
public static void RewriteRoutesForTesting(RouteCollection routes)
{
using (routes.GetReadLock())
{
bool foundDebugRoute = false;
foreach (RouteBase routeBase in routes)
{
Route route = routeBase as Route;
if (route != null)
{
route.RouteHandler = new DebugRouteHandler();
}
if (route == DebugRoute.Singleton)
foundDebugRoute = true;
}
if (!foundDebugRoute)
{
routes.Add(DebugRoute.Singleton);
}
}
}
}