I had a requirement where I needed to call RouteUrl method from C# code that would generate a URL based on the controller, action and other parameter passed. In general, its find to proper object to call this from.
Here is the solution of that problem
var url = new UrlHelper(HttpContext.Current.Request.RequestContext).RouteUrl("Default",
new { controller = "Drawings", action = "Details", id = item.AutoId, title = item.Title }));
We need to instantiate UrlHelper class that exists in
System.Web.Mvc namespace and pass necessary parameter.
Hope this helps.