a collection of technical fixes and other randon stuff

Spodworld

  • Join Us on Facebook!
  • Follow Us on Twitter!
  • LinkedIn
  • Subcribe to Our RSS Feed

How to fix error: "The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult"

Problem

When navigating to an MCV web page/action/controller, or when you launch your project for debugging, you may see this error displayed in your browser:


The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult in .........
.....
An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
Parameter name: parameters



This is because the method of your MVC controller is expecting a parameter which hasn't been supplied.
If this is happening when in your application, maybe you forgot to pass the required parameters into the controller's method.

If you are launching from visual studio/debugging, then this may just be the case that Visual Studio has chosen to launch the page you are currently working on without parameters. Just navigate to your home page or know good starting point to get round this.

Add comment

Loading