RequestContext
is available as a property to HttpRequest object, so you can refer it as HttpContext.Current.Request.RequestContext
. For example,
public string GetRouteUrl(string routeName, object routeParameters)
{
var dict = new RouteValueDictionary(routeParameters);
var data = RouteTable.Routes.GetVirtualPath(HttpContext.Current.Request.RequestContext, routeName, dict );
if (data != null)
{
return data.VirtualPath;
}
return null;
}