title: asp.net mvc: Can we set http status code when route does not match
body: <p>suppose this is my route which expect integer data for productid</p>
  
  <pre><code>routes.MapRoute(
      "Product",
      "Product/{productId}",
      new {controller="Product", action="Details"},
      new {productId = @"\d+" }
   );
  </code></pre>
  
  <p>so these route will work</p>
  
  <pre><code>/Product/3
  /Product/8999 
  </code></pre>
  
  <p>how could i redirect user to a preexisting view where i can show a friendly error message for this scenario?</p>
  
  <p>one more things i like to know can we set status code when user will type <code>/Product/apple</code> and this route will not match any. so in this case i like to set <code>statusCode="404"</code>. if i can do it then below <code>customErrors</code> where i specified a view will be shown for 404 error. suggest me how to do it?</p>
  
  <pre><code>&lt;customErrors mode="Off" defaultRedirect="~/error.html"&gt;
    &lt;error statusCode="403" redirect="~/access-denied.aspx" /&gt;
    &lt;error statusCode="404" redirect="~/page-not-found.aspx" /&gt;
    &lt;error statusCode="500" redirect="~/error.html" /&gt;
  &lt;/customErrors&gt;
  </code></pre>
  
  <p>please guide me if it is possible.</p>