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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:14:37+00:00 2026-05-12T13:14:37+00:00

Trying to get started with MS’s implementation of MVC and I’m already in a

  • 0

Trying to get started with MS’s implementation of MVC and I’m already in a jam..

I have a have a route like so:

  routes.MapRoute( "Custom", // Route name
           "RightHere/{entryDate}", // URL with parameters
           new { controller = "RightHere", action = "GetDate" } // Parameter defaults

           ); 

And the corresponding controller action (RightHereController) looks like so:

 public ActionResult GetDate(DateTime date)
    {


             try
             {
                 ViewData["Date"] = date;
                 return View();
             }
             catch
             {
                 return View();
             }
    }

The view:

<h2>RightHere</h2>
<p><%= Html.Encode(ViewData["Date"]) %></p>

Simple enough.. But get the orange screen of death when using URL /RightHere/GetDate/1-1-2009

:

The parameters dictionary contains a null entry for parameter 'date' of non-nullable type 'System.DateTime' for method 'System.Web.Mvc.ActionResult GetDate(System.DateTime)'

Need you more tenured Ms MVC peps tell me what I’m missing 🙂

  • 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-12T13:14:37+00:00Added an answer on May 12, 2026 at 1:14 pm

    You actually have two problems. The first problem is that the URL you mentioned above doesn’t match the route you created. The second problem lies with your route and your action not quite matching.

    You have this for the URL in your question:

    /RightHere/GetDate/1-1-2009

    It needs to be this:

    /RightHere/1-1-2009

    If you want it to be the latter, then you need to change your route to this:

    routes.MapRoute(
        "Custom", 
        "RightHere/GetDate/{entryDate}", 
        new { controller = "RightHere", action= "GetDate" }
    );
    

    You have this for your action:

    public ActionResult GetDate(DateTime date)
    {
        ...
    }
    

    It needs to be this, to match your route:

    public ActionResult GetDate(DateTime entryDate)
    {
        ...
    }
    

    Other than that, you’re good to go. Just make sure you have the route at the top, above the default route. I can recommend one other thing that would help is by adding a constraint to your route, for example:

    routes.MapRoute(
        "Custom", 
        "RightHere/{entryDate}", 
        new { controller = "RightHere", action= "GetDate" }, 
        new { entryDate = @"\d{2}-\d{2}-\d{4}"}
    );
    

    This makes sure that the entry date passed in, is in the correct format.

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

Sidebar

Related Questions

I am trying to get started with scons . I have Python 3.0.1 and
i'm trying to get started with silverlight 2. i have a weird bug. every
I am trying to get started with the PHP MVC framework, CodeIgniter. I am
I'm trying to get started with the repository pattern and ASP.NET MVC, and I
I'm trying to get started with Django, and have previously worked with CakePHP, and
I am trying to get started and understand what exactly is Javascript MVC framework
Trying to get started with subsonic but have a simple question about stored procedures
I am trying to get started with pic24's, specifically the PIC24FJ64GA002, and I have
I'm trying to get started with Amazon's EC2. I have to choose an image
I'm trying to get started with session-scoped beans in Spring Web MVC 3. I

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.