title: MVC 3 exception: The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc
body: <p>My application seems to run fine, but I keep getting these exceptions in log4net logs: </p>
  
  <pre><code>The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Agency(Int32)' in 'COPSGMIS.Controllers.QuestionController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
  </code></pre>
  
  <p>Not sure whats going wrong?</p>
  
  <p>My controller:</p>
  
  <pre><code> public ActionResult Agency(int id)
          {
                  QuestionDAL qd = new QuestionDAL();
                  var agency = qd.GetAgencyDetails(id);
                  agency.Reviews = qd.GetAgencyReviews(id);
  
                  return View(agency);
          }
  </code></pre>
  
  <p>My routes:</p>
  
  <pre><code> public static void RegisterRoutes(RouteCollection routes)
          {
              routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  
              routes.MapRoute(
                  "Default", // Route name
                  "{controller}/{action}/{id}", // URL with parameters
                  new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
              );
  
          }
  </code></pre>