title: MVC routing - exceptions if I put parameter id
body: <p>I need to put the product id in the url in (ProductDetails page) with MVC routing.
  Without the id parameter everything is working fine, but if I put the id, I get this exception. </p>
  
  <blockquote>
    <p>Server Error in '/' Application.
    The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult SubCategories(System.String, Int32, System.String, System.String)' in 'OnlineCarStore.Controllers.ProductController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
        Parameter name: parameters
        Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.</p>
  </blockquote>
  
  <pre><code>Exception Details: System.ArgumentException: The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult SubCategories(System.String, Int32, System.String, System.String)' in 'OnlineCarStore.Controllers.ProductController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
  Parameter name: parameters
  </code></pre>
  
  <p>This is what I have in the view:</p>
  
  <pre><code>  &lt;a href="@Url.Action("ProductDetails", "Product" , new {supplierName = c.SupplierName.Replace(" ", "-"), code = productCode, name = name.Replace("---", "-"), prodId=c.ProductId })" id="link"&gt;
       Details
    &lt;/a&gt;    
  </code></pre>
  
  <p>and in the controller:</p>
  
  <pre><code> [Route("{supplierName}/{code}/{name}/{prodId}")]
   public ActionResult ProductDetails(string supplierName, string code, string name, string prodId)
   {...}
  </code></pre>
  
  <p>Can you please advise what can be the problem? As I said without the prodId parameter everything is fine. Thanks in advance!</p>