using System;
using System.IO;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
class Program
{
static void Main()
{
RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
RouteTable.Routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
var request = new HttpRequest("/", "http://foo.com", "");
var response = new HttpResponse(new StringWriter());
var httpContext = new HttpContext(request, response);
var httpContextBase = new HttpContextWrapper(httpContext);
var routeData = new RouteData();
var requestContext = new RequestContext(httpContextBase, routeData);
var urlHelper = new UrlHelper(requestContext, RouteTable.Routes);
var url = urlHelper.Action("Index", "Home", new { id = "123" }, "http");
Console.WriteLine(url);
}
}