I have a routelink :
@Html.RouteLink("Campaigns", "DefaultApi", new { controller = "Campaign", httproute = true })
that results in "http://localhost:54614/api/v0.1/ReportData/Account"
what I want to do is write a Routelink – that would result in
"http://localhost:54614/api/v0.1/ReportData/Account/?$top=20"
How can I do that ?
You you can’t use
$topas a property name in an anonymous type so you should use a differentRoutelinkoverload which usesRouteValueDictionary.But the problem is that
RouteLinkusesUri.EscapeUriStringto escape the route values so using the following code:Will produce this url:
/api/Campaign?%24top=20(see the$was encoded to%24)However using a very very dirty hack namely
Uri.UnescapeDataString:You can get:
/api/Campaign?$top=20