Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8069307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:59:07+00:00 2026-06-05T12:59:07+00:00

I have a routelink : @Html.RouteLink(Campaigns, DefaultApi, new { controller = Campaign, httproute =

  • 0

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 ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T12:59:08+00:00Added an answer on June 5, 2026 at 12:59 pm

    You you can’t use $top as a property name in an anonymous type so you should use a different Routelink overload which uses RouteValueDictionary.

    But the problem is that RouteLink uses Uri.EscapeUriString to escape the route values so using the following code:

    @Html.RouteLink("Campaigns", "DefaultApi", new RouteValueDictionary
                                                  {
                                                      { "controller", "Campaign"} ,
                                                      { "httproute", true },
                                                      { "$top", 20 }
                                                  })
    

    Will produce this url: /api/Campaign?%24top=20 (see the $ was encoded to %24)

    However using a very very dirty hack namely Uri.UnescapeDataString:

    @Html.Raw(Uri.UnescapeDataString(
        @Html.RouteLink("Campaigns", "DefaultApi", new RouteValueDictionary
                                            {
                                                { "controller", "Campaign"} ,
                                                { "httproute", true },
                                                { "$top", 20 }
                                            }).ToHtmlString()))
    

    You can get: /api/Campaign?$top=20

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a working Html.RouteLink that I want to convert to T4MVC. The working
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
I have a specialized search engine that passes search criteria from the Search page
I have a route defined with several hardcoded (non-parameter) segments: routes.MapRoute(null, suggestion/list/by/{tag}, new {
If I do not want to do this in my View Markup, <%=Html.RouteLink(Listings, Listings,
I have a table that lists users that are registered at my website. The
Asp.net Mvc1 On my Views/home/Index.aspx which routes from http://localhost/DefectSeverityAssessmentMvcBeta/ This renders Response.Write(<a href=\); Response.Write(Url.Action(Create,
I have a question regarding RouteLink vs. ActionLink. Consider the following route routes.MapRoute(Routename1, {someEnum}/SpecificAction/{id}/{stringId},
Have some code: using (var ctx = new testDataContext()) { var options = new
Have a look at one of my websites: moskah.com The problem is that it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.