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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:06:50+00:00 2026-05-23T18:06:50+00:00

So I have this controller called Cars, and it has: namespace MySite.Controllers { public

  • 0

So I have this controller called Cars, and it has:

namespace MySite.Controllers
{
    public class CarsController : ApplicationController
    {

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

        public ActionResult New()
        {
            return View();
        }
        [httppost]
        public ActionResult New()
        {
            return View();
        }


        public ActionResult Details(int id)
        {
            return View();
        }
    }
}

Global asax

       routes.MapRouteLowerCase(
            "Cars", // Route name
            "Cars/{id}", // URL with parameters
            new { controller = "Cars", action = "Details", id = URLParameter.Optional}
        );

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

So following is the error I’m getting:

the parameters dictionary contains a null entry for parameter of non
nullable type for method in

NOTE: It’s getting me redirected to the “Details” View and is asking for an int even thought I wanted to go to the “New” view. I’m not really sure what’s happening? I basically wanted to have my urls lowercased while removing the “action” on the url on the Promoter routing…Does that make sense?
Anyhelp is appreciated! Thanks!!!

  • 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-23T18:06:50+00:00Added an answer on May 23, 2026 at 6:06 pm

    All code below applies to the first route definition.
    Second route definition should stay as it is.

    Your routing is invalid

    Take a look at the first route definition:

    routes.MapRouteLowerCase(
        "Cars", // Route name
        "Cars/{id}", // URL with parameters
        new { controller = "Cars", action = "Details", id = URLParameter.Optional}
    );
    

    And when you access Cars/New this first route gets hit because all parameters are easily applied as:

    • controller = "Cars"
    • action = "Details"
    • id = "New"

    If you’d like the first route definition to only cover certain IDs you should put a constraint onto it or change your routing. Constraint for numeric IDs should look like this:

    routes.MapRouteLowerCase(
        "Cars", // Route name
        "Cars/{id}", // URL with parameters
        new { controller = "Cars", action = "Details" },
        new { id = @"\d+" }
    );
    

    When you’d access Cars/New first route wouldn’t be hit because New doesn’t satisfy ID constraint so route processing would continue with the next route (which would resolve it just fine – as it should).

    Mind the fact, that id isn’t optional anymore. In case of putting a constraint onto it it can’t be. If you have a Details controller action it should most probably display some certain details. So it actually needs some ID.

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

Sidebar

Related Questions

I have an action like this: public class News : System.Web.Mvc.Controller { public ActionResult
I have a controller with a action similar to this class EventsController < ApplicationController
I have this Controller : @Controller @RequestMapping(/path/*) public class MyController { @RequestMapping(value = /,
I have a controller called MetricsController with a single action method: public class MetricsController
I am getting some unexpected behavior from Html.EditorFor(). I have this controller: [HandleError] public
I have this constructor; public UmlDiagramEntity(ReportElement reportElement, int pageIndex, Controller controller) { super(reportElement.getX1(), reportElement.getY1(),
I have a controller called NewsController, the constructor of this controller receives an INewsService
Lets say i have a Controller like this one : @RequestMapping(method=RequestMethod.GET, value=/error) public void
The goal is to have a singleton data controller class called FetchData.h/.m that pulls
I have a controller called AuctionsController. In it I have Actions called Index() and

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.