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

  • Home
  • SEARCH
  • 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
  • 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. 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

Ask A Question

Stats

  • Questions 62k
  • Answers 62k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Use the VerticalAlignment Property <StackPanel Orientation='Horizontal'> <Button Height='40'>OK</Button> <TextBox Width='200'… May 11, 2026 at 10:00 am
  • added an answer There are several 3rd party libs out there (e.g. Aspose.Words… May 11, 2026 at 10:00 am
  • added an answer Beej's Network Programming Guide if you call recv in blocking… May 11, 2026 at 10:00 am

Related Questions

On an ASP.NET MVC (Beta) site that I am developing sometimes calls to ActionLink
On an ASP.NET MVC website, what's the best way to implement access logging? I
So I'm embarking on an ASP.NET MVC project and while the experience has been
I am working on an ASP.NET MVC web app that allows people to publish
I'm currently working on an asp.net-mvc content management system. It would be incredibly useful
I am working on an ASP.NET MVC application that contains a header and menu
I am working on an ASP.NET MVC application where I need to export data
I'm working on an ASP.NET MVC application. The app is broken up into a
I'm working on an asp.net-mvc application. The linq data context is being passed into
I need to provide a window on an ASP.NET MVC web page where registered

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.