Hi folks,
I'm converting one of our ASP.NET MVC application from 1.0 to 2.0.
This is code that is erroring :-
string virtualPath = HttpContext.Request.ServerName() +
RouteTable.Routes.GetVirtualPath(
new RequestContext(HttpContext,
RouteTable.Routes.GetRouteData(HttpContext)),
ExpressionHelper.GetRouteValuesFromExpression<PostController>(
c =>c.Details("Post-Title")))
.VirtualPath;
Ok .. that's a lot of ugly code. So what's going on?
It looks like we're trying to get the virtual path of a route. The FULL path, that is. Further investing the reason, it's because this value is used in some Service code, which has no idea about MVC or websites, etc. It's independent from the View. It needs a virtualPath because it converts that to a TinyUrl (yeah, one of those url shortening services).
So ... how can I do this in ASP.NET MVC 2.0 (using VS2010 B2)?
What's the error message?
'ExpressionHelper' is an ambiguous reference between 'System.Web.Mvc.ExpressionHelper' and 'Microsoft.Web.Mvc.Internal.ExpressionHelper'
hmmm ......