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 70355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:43:04+00:00 2026-05-10T19:43:04+00:00

On an ASP.NET MVC (Beta) site that I am developing sometimes calls to ActionLink

  • 0

On an ASP.NET MVC (Beta) site that I am developing sometimes calls to ActionLink will return to me URLs containing querying strings. I have isolated the circumstances that produce this behavior, but I still do not understand why, instead of producing a clean URL, it decides to using a query string parameter. I know that functionally they are the same, but for consistency (and appearance) of the URLs this is not what I want.

Here are my routes:

routes.MapRoute(     'Photo Gallery Shortcut',     'group/{groupname}',     new { controller = 'Photos', action = 'All', Id = '' });  routes.MapRoute(     'Tagged Photos', //since the Tagged action takes an extra parameter, put it first     'group/{groupname}/Photos/Tagged/{tagname}/{sortby}',     new { controller = 'Photos', action = 'Tagged', Id = '', SortBy = '' });  routes.MapRoute(     'Photo Gallery', //since the Gallery's defualt action is 'All' not 'Index' its listed seperatly     'group/{groupname}/Photos/{action}/{sortby}',     new { controller = 'Photos', action = 'All', Id = '', SortBy = '' });  routes.MapRoute(     'Group',  //<-- 'Group' Category defined above     'group/{groupname}/{controller}/{action}/{id}',     new {controller = 'Photos', action = 'Index', Id = ''}); 

Now the problem only occurs when I am looking at the view described by the route named ‘Tagged Photos’ and execute ActionLink via:

Html.ActionLink<PhotosController>(p => p.All((string)ViewData['group'], ''), 'Home') 

Which produces the URL:

http://domain/group/GROUPNAME?sortBy= 

From any other view the URL produced is:

http://domain/group/GROUPNAME 

I have pulled down Phil’s ASP.NET Routing Debugger, and everything appears in order. This one has me stumped. Any ideas?

  • 1 1 Answer
  • 3 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. 2026-05-10T19:43:05+00:00Added an answer on May 10, 2026 at 7:43 pm

    Not sure why different views are producing different URLs.

    But you can get rid of that sortBy param by assigning a default value to the first route.

    new { sortBy = ” }

    During generation, if sortBy matches the default, the route engine will skip that parameter (if it’s in the query string).

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

Sidebar

Related Questions

We are developing an ASP.NET MVC web app that will be hosted on Windows
I have a site that was using ASP.Net MVC Beta 5, and I have
I'm building an ASP.NET MVC 2 site with Visual Studio 2010 Beta 2. Out
I have an ASP.NET MVC (Beta 1) website that I'm using themes with. When
I'm working in an ASP.NET MVC Beta 1 project, and I've noticed that if
I'm just starting to get into ASP.NET MVC, and saw today that the Beta
I am working on a asp.net mvc site that uses facebook social widgets. Whenever
We’ve created an ASP.NET MVC 4.0 (Beta) web site with Visual Studio 2010. The
I'm creating an Intranet site in ASP.NET MVC 3 Beta and would like to
I just downloaded the ASP.NET MVC beta and wanted to walk through the quickstarts

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.