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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:37:23+00:00 2026-06-06T14:37:23+00:00

In my MVC application I have a default route defined: routes.MapRoute( Default, // Route

  • 0

In my MVC application I have a default route defined:

routes.MapRoute(
    "Default", // Route name
    "{controller}/{action}/{id}", // URL with parameters
    new { controller = "Home", action = "Index", id = UrlParameter.Optional },
    new []{ "Demo.Controllers" }
);

I created a new Area called Admin and it added a route to in the AdminAreaRegistration class:

public override void RegisterArea(AreaRegistrationContext context)
{
    context.MapRoute(
        "Admin_default",
        "Admin/{controller}/{action}/{id}",
        new { action = "Index", controller = "Home", id = UrlParameter.Optional }
    );
} 

In my main _Layout file I tried to do the following:

@Html.RouteLink("Admin", "Admin_default")

It only works in certain cases (such as if I’m already in an Admin page). If I am in the /Home/About section of my site, then the URL gets generated like so:

/Admin/Home/About

If I am in my Index action of the Home controller (in the main area, not admin) then the URL gets generated like so:

/Admin

Why doesn’t RouteLink work like I think it should using Areas in MVC?

  • 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-06T14:37:24+00:00Added an answer on June 6, 2026 at 2:37 pm

    @Html.RouteLink("Admin", "Admin_default") this route uses the route with the name of Admin_default so it will always use that route to generate the url.

    @Html.RouteLink("Admin", "Admin_default", new { controller = "Home", action = "Index" })

    When you don’t specify stuff like route values most of MVC uses the values that currently exist. In this case since the action and controller values are null it looks at the RouteValues and checks to see if they’re there and if they’re found they use the values found there instead.

    This is sometimes helpful. For instance if you want {id} to be populated with the same value that was used on the page.

    Url: /home/edit/1701

    @Html.RouteLink("Refresh", "Default") would result in the same exact url – you can specify overrides if you want.

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

Sidebar

Related Questions

If we use this standard route: routes.MapRoute( Default, // Route name {controller}/{action}/{id}, // URL
using the default route routes.MapRoute( Admin, // Route name Admin/{action}, // URL with parameters
I have default routing set for my mvc application like: routes.MapRoute( Default, // Route
I have an ASP.NET MVC application with the default membership database. I am accessing
In my application I have controller named Snippets both in default area (in application
I have an ASP.NET MVC 2 application with a custom StructureMap controller factory to
I have an ASP.NET MVC application. I have the routingUrl as http://myapp/Home/Products/Productname/DocTypename/CountryName Now i
This is not an MVC topic. I have an ASP.NET Application which performs URL
I have no custom routes in my application, only the default one. If i
In my ASP .NET MVC application i have a link that refreshes the preview

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.