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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:02:44+00:00 2026-06-10T07:02:44+00:00

I have a default routing so if I go to www.domain.com/app/ it’s, for example,

  • 0

I have a default routing so if I go to http://www.domain.com/app/ it’s, for example, the HomeController. I have another action on the control, e.g. helloworld but if I go to http://www.domain.com/app/helloworld it fails with a 404 (expecting helloworld controller no doubt).

How can I can non-default actions on my default controller OR how can I map the url /app/helloworld to the helloworld action. My routing looks like this:

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

routes.MapRoute( //this fails with same 404 like it does when it's ommitted
"Hello", // Route name
"app/helloworld", // URL with parameters
new { controller = "Home", action = "HellowWorld", id = UrlParameter.Optional } // Parameter defaults
);

Basically I need:

/app/ => Controller = Home, Action = Index

/app/helloworld => Controller = Home, Action = HelloWorld,
not Controller = HelloWorld, Action – Index

/app/other => Controller = Other, Action = Index

  • 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-10T07:02:46+00:00Added an answer on June 10, 2026 at 7:02 am

    Replace the 2 routes in your Global file with this:

    routes.MapRoute(
        "Default", // Route name
        "App/{controller}/{action}/{id}", // URL with parameters
        new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
        );
    

    Then verify your HomeController contains:

    public ActionResult Index()
    {
        return View();
    }
    
    public ActionResult HelloWorld()
    {
        return View();
    }
    

    What this is doing is that yoursite.com/app/ANYCONTROLLER/ANYACTION will route to the controller and action (as long as they exist,) and the default new { controller = "Home", action = "Index" means that if someone goes to yoursite.com/app/ it will automatically route to yoursite.com/app/Home/Index.

    If this doesn’t work try removing the app/ so it will look like:

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

    What you had looks like you were trying to route yoursite.com/Home/Index and the second route was phrased wrong, I’m not sure what it would do but instead of "app/helloworld it should have looked like "app/HelloWorld/{action}/{id}" then new { controller = "Home", action = "HellowWorld" would work. So that if someone went to yoursite.com/app it would automatically display yoursite.com/app/Home/HelloWorld. Hope that helps clear some things up.

    This is the answer you want

    For some reason you don’t want to create a new controller for the hello world section, your RegisterRoutes in the Global file should look like this:

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    
            routes.MapRoute(
                "Hello World", // Route name
                "App/HellowWorld/{id}", // URL with parameters
                new { controller = "Home", action = "HelloWorld", id = UrlParameter.Optional }
                );
    
            routes.MapRoute(
                "Default", // Route name
                "App/{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
                );
        }
    

    Although I would not recommend going about it this way.

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

Sidebar

Related Questions

I have some default values for testing my code, but for security reasons those
I have a little app that have by default youtube as homepage. You can
I am having difficulty with code igniter routing. http://www.mysite.com goes to the right controller
With ASP MVC the routing works with the following code routes.MapRoute(Default, {controller}/{action}/{id}, new {
the default route is :controller/:action/:id but I want just : controller/:action for my errors
I have a stock WCF Rest application (default Web.config, Web Routing). I am unable
I am working on a project, where I have used the default routing routes.MapRoute(
I need to provide following functionality for one of the web sites. http://www.example.com/ [sponsor]
I have a routing question that i have been tinkering with but have been
My server have default php version of 4, so when I run some script

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.