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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:59:17+00:00 2026-05-20T16:59:17+00:00

I am having an issue with MVC-3 generating outgoing routes for me. This is

  • 0

I am having an issue with MVC-3 generating outgoing routes for me.

This is the address of the page I am on for both scenarios: http://localhost:1283/Conflict/Create/1200/300

Here are the map routes:

routes.MapRoute(
    null, // Route name
    "{controller}/{action}/{custId}/{projId}", // URL with parameters
    null, // Parameter defaults
    new { custId = @"\d+", projId = @"\d+" }
);

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

Scenario 1:

From the controller:

public ActionResult Create(int custId, int projId)
{
    return View();
}

From the view:

@Html.ActionLink("Back to List", "Index", "Conflict", new { custId = ViewBag.custId, projId = ViewBag.projId }, null)

The resulting link that gets created.

http://localhost:1283/Conflict?custId=1200&projId=300

If I change the controller code to read as follows:

public ActionResult Create(int custId, int projId)
{
        ViewBag.custId = custId;
        ViewBag.projId = projId;

        return View();
}

I didn’t make any changes in the view, only added those two lines to the controller and the following link is created:

http://localhost:1283/Conflict/Index/1200/300

What am I missing here? This is consistent behavior, I was able to reproduce this in other areas of my application. The “solution” is obvious, but my question is why?

  • 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-20T16:59:18+00:00Added an answer on May 20, 2026 at 4:59 pm

    What’s happening is the “?custId=1200&projId=300” part of your link is coming over from the link you used to GET the page you’re on. So the Html.ActionLink call is doing this:

    1. generate the /Conflict/Index path
    2. look for the custId and projId in the ViewBag and finds the query string instead
    3. just appends your query string

    In the second scenario, you’re actually providing values, so the link is generating normally. Hope that helps.

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

Sidebar

Related Questions

I am having an issue with caching the home page of my Asp.Net Mvc
i'm having this issue, in ASP.NET MVC 2 where I'm adding a drop down
I am having this really weird issue with downloading files from within ASP.Net MVC
I am having a weird issue in MVC. I am using ASP.Net MVC, I
I am having an issue with my ASP MVC application. When I Log in
I am trying to learn asp.net MVC and having an issue to submit a
I'm having a tricky issue (bear with me as I'm new to MVC) with
I'm working with Telerik's MVC Tabstrip control and am having an issue, although I
I'm having an issue with exceptions showing app as stack traces in the page.
Ok so I'm having some strange issue with an mvc 3 site using javascript

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.