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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:59:57+00:00 2026-06-14T07:59:57+00:00

My issue is that I made a Map Route in MVC which takes three

  • 0

My issue is that I made a Map Route in MVC which takes three parameters. When I supply all three or just two, the parameters are passed from the URL to my controller. However, when I only supply the first parameter, it is not passed and returns null. Not sure what causes this behavior.

Route:

        routes.MapRoute(
            name: "Details",                                              // Route name
            url: "{controller}/{action}/{param1}/{param2}/{param3}",                           // URL with parameters
            defaults: new { controller = "Details", action = "Index", param1 = UrlParameter.Optional, param2 = UrlParameter.Optional, param3 = UrlParameter.Optional }  // Parameter defaults
         );

Controller:

    public ActionResult Map(string param1, string param2, string param3)
    {

        StoreMap makeMap = new StoreMap();
        var storemap = makeMap.makeStoreMap(param1, param2, param3);
        var model = storemap;
        return View(model);
    }

string param1 returns null when I navigate to:

/StoreMap/Map/PARAM1NAME

but it doesn’t return null when I navigate to:

/StoreMap/Map/PARAM1NAME/PARAM2NAME

  • 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-14T07:59:58+00:00Added an answer on June 14, 2026 at 7:59 am

    Most likely the default route is interfering. I believe the default route defined in the project template looks like this:

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
         );
    

    Your URL with only one parameter matches this pattern, but since you don’t have an id parameter in your method signature, the value doesn’t get populated into any of your parameters.

    You could try altering your “Details” route to hard-code the controller to be “Details”, as shown below, and move it so that it comes before the default route:

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

    Alternatively, try renaming the first parameter in your route and your method signature to id.

        routes.MapRoute(
            name: "Details",                                              // Route name
            url: "{controller}/{action}/{id}/{param2}/{param3}",                           // URL with parameters
            defaults: new { controller = "Details", action = "Index", id = UrlParameter.Optional, param2 = UrlParameter.Optional, param3 = UrlParameter.Optional }  // Parameter defaults
         );
    
    
    public ActionResult Map(string id, string param2, string param3)
    {
    
        StoreMap makeMap = new StoreMap();
        var storemap = makeMap.makeStoreMap(id, param2, param3);
        var model = storemap;
        return View(model);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We were faced with very strange issue that made us crazy. Sometimes newly created
I have a simple client server program that I made but the main issue
I have an issue that has just recently come to my attention. We have
Our development policy dictates that all database accesses are made via stored procedures, and
I have an issue that is driving me crazy right now. Yesterday I made
So I have an issue that I'm not 100% sure on how to solve.
I have an issue that (I think) might have to do with scope, but
I have an issue that is driving me nuts and hoping someone can help.
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So
I am having an issue that I can't seem to figure out. Hopefully somebody

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.