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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:03:57+00:00 2026-05-25T13:03:57+00:00

I have an area which is registered as: public override void RegisterArea(AreaRegistrationContext context) {

  • 0

I have an area which is registered as:

public override void RegisterArea(AreaRegistrationContext context) {
    context.MapRoute("CPanel_default",
        "CPanel/{controller}/{action}/{id}/{*urlData}",
        new { id = UrlParameter.Optional, urlData = UrlParameter.Optional });
}

This route is intended to full a number of urls:

  • /cpanel/home/index
  • /cpanel/entity/edit/20
  • /cpanel/entity/edit/20/abitrary-url-data

Haack’s route debugger has shown me that the route is functioning in this capacity. However, my code for generating action links has recently broken and I haven’t been able to find out the cause of the break.

Action links are being generated with the following code:

public static MvcHtmlString CpanelLink(this HtmlHelper @this, string linkText, 
    string actionName, string controllerName, string areaName = "CPanel") {

    return @this.ActionLink(linkText, 
        actionName, new { controller = controllerName, area = areaName });
}

Which, as far as I can tell, should account for all the required fields in the area route. Debugging shows that CpanelLink is returning <a href="">...</a>, a link to nothing.

Edit

Additional troubleshooting has reveled that the route parameter {*urlData} is killing Html.CpanelLink. Reducing the route to “CPanel/{controller}/{id}” clears the issue, but breaks urls which depend on the urlData parameter.

  • 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-25T13:03:58+00:00Added an answer on May 25, 2026 at 1:03 pm

    The problem is you can’t pass the controller name in as a route parameter.

    You need to use the following ActionLink() method signature

    return @this.ActionLink(linkText, actionName, controllerName, new { area = areaName }, null);
    

    Note the last parameter value is ‘null’ which represents the html attributes.

    UPDATE:

    The other problem is to do with consecutive optional parameters, as described in Phil Haack’s blog post

    So you need to do the workaround as such;

     context.MapRoute(
                    "Route_withUrl",
                    "CPanel/{controller}/{action}/{id}/{urlData}",
                    new { controller = "Home", action = "Index" }
                );
    
                context.MapRoute(
                    "Cpanel_default",
                    "CPanel/{controller}/{action}/{id}",
                    new { controller = "Home", action = "Index", id = UrlParameter.Optional}
                );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an area which is represented by constrained delaunay triangulations. I am playing
I have a header area which is divided up into block areas for images,
I have a text area page which is launched from the previous page: $message
I have a text area on which I would like to listen to change
Does JavaFX 2.0 supports printing? I have a text area from which I take
I have web-service which give list of property at a particular area My problem
I have data for countries which include Name, Population, Area etc for countries... What
I have an area which gets populated with about 100 records from a php
In my application, I have a Area(XYZ) having a controller(XYZController) and bunch of other
I recently inherited a website and they have a simple back-end area which was

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.