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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:05:29+00:00 2026-05-25T10:05:29+00:00

This one has been throwing me so I figured I’d ask for some help.

  • 0

This one has been throwing me so I figured I’d ask for some help. I’ve got this to work with my “Categories” routes, but for some reason when I’m trying to do the same thing with “Consumers” it’s not working at all. Here is the necessary background info:

Routing (AdminAreaRegistration.cs):

public override void RegisterArea(AreaRegistrationContext context)
    {
        //matches /Admin/BusinessCategories/MyCategory/children
        context.MapRoute(
            "ChildCategories",
            "Admin/BusinessCategories/{category}/children",
            new { controller = "BusinessCategories", action = "ViewChildren" }
        );

        //matches /Admin/BusinessCategories/MyCategory/edit
        context.MapRoute(
            "EditCategory",
            "Admin/BusinessCategories/{category}/edit",
            new { controller = "BusinessCategories", action = "Edit" }
        );

        // want this to match /Admin/Consumers/JoeBob/details
        context.MapRoute(
            "ConsumerDetails",
            "Admin/Consumers/{alias}/details",
            new { controller = "Consumers", action = "Details" }
        );

        //matches /Admin
        //matches /Admin/BusinessCategories
        //matches /Admin/BusinessCategories/New

        context.MapRoute(
            "Admin_default",
            "Admin/{controller}/{action}/{id}",
            new { controller = "AdminHome", action = "Index", id = UrlParameter.Optional },
            new { id = @"\d+" }
        );
    }

Then in my Consumers controller (ConsumersController.cs):

public class ConsumersController : Controller
{

    public ActionResult Index()
    {
        ...code...
    }

    [HttpGet]
    public ActionResult Details(string alias)
    {
        return View(alias);
    }
}

Then I am generating my link like so:

@Html.ActionLink(c.Alias, "Details", "Consumers", new { alias = c.Alias }, null)

The problem is that my call to @Html.ActionLink is generating a link like:

/Admin/Consumers/details?alias=JoeBob (which results in a 404, if clicked on)
rather than what I want, which is:

/Admin/Consumers/JoeBob/details

One thing I’ve noticed is if I change alias = c.Alias to id = c.Alias, it produces a URL like:
/Admin/Consumers/details/JoeBob (so it removes the alias part from the query string, but still puts ‘details’ before the alias.)

Any ideas?

Edit: Rebooting IIS solved the issue for me. Not sure why, but it did.

  • 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-05-25T10:05:30+00:00Added an answer on May 25, 2026 at 10:05 am

    Your routes are configured properly (I tested them). I suspect that you’re getting this misbehavior because the view that contains your @Html.ActionLink() mark-up is outside of your Admin Area. If it is inside your Admin Area, you should be seeing the proper link generated. However, outside of your Admin Area, you need to declare which area you’re targeting like this:

    @Html.ActionLink(c.Alias, "Details", "Consumers", new { alias = c.Alias, area = "Admin" }, null)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This one has been stumping me for a while. But I'm no expert. This
This one has been bugging me for a while now, but I never seem
Nothing I've found has been able to help me solve this one specific case.
This question has been brought up many times, but I'd like to ask it
This one has been bugging me for a while now. Is there a way
This has been one of the biggest obstacles in teaching new people ColdFusion. When
This could be considered a duplicate question, as a similar one has already been
This one has us all baffled at work. We have two services running on
This one has me puzzled. It seemed like an easy task, but the solution
This one has me stumped. I've got a java.sql.ResultSet and I'm pulling string values

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.