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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:37:47+00:00 2026-06-11T02:37:47+00:00

By default if url is ‘mydomain’ it go to controller home; action = index.

  • 0

By default if url is ‘mydomain’ it go to controller home; action = index.

But when index action has params the url have to be:

mydomain/home/index?name=John

want to get:

mydomain?name=John

What should be define for create such url?

Thanks,

Yosef

  • 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-11T02:37:48+00:00Added an answer on June 11, 2026 at 2:37 am

    Are you sure you want mydomain/home/index?name=John and mydomain?name=John as your urls in your site?

    If you corrected your routing engine, your routes could be, mydomain/home/index/john and mydomain/john, which to me would be more correct.

    Is that what you’re going for?

    If so, assuming you have a Index action, accepting a string parameter of name in your home controller, you could modify your global.asax, and change the default route, and add a route below the standard default route like this:

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

    Be sure you put the name only route at the bottom, as a string based parameter will match everything, so you need to match the more explicit ones first.

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

Sidebar

Related Questions

I have the following route: routes.MapRoute( Default, // Route name {controller}/{action}/{id}, // URL with
using the default route routes.MapRoute( Admin, // Route name Admin/{action}, // URL with parameters
after debbuging i am getting following url of my webproject: http://localhost:54594/Home/Home /Home-Controller/Home-Action http://localhost:54594/AboutUs/AboutUs /AboutUs-Controller/AboutUs-Action
I have the following URl: http://localhost:12981/BaseEvent/EventOverview/12?type=Film This is route: routes.MapRoute( Default, // Route name
I'd like to have an explicit servlet for a particular URL and a default(sort
We need to default URL to unique name. If it is www then with
I have a class Post I want the default URL of each posts to
How to change the default url. eg www.example.com/index.php -> www.example.com now i want to
I have 2 different urls: mywebsite.com and myotherdomain.com mywebsite.com is the default URL that
I have a newbie question: I'm storing a default URL (pointing to an image

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.