title: Negative parameter in MVC url
body: <p>In the MVC routing engine, a url of "/MyController/Action/-123/type" and a routing rule of:</p>
  
  <pre><code>routes.MapRoute(name: "AddRemoveRequestee",
             url: "{controller}/{action}/{requestId}/{someOtherData}",
             defaults: new { },
             constraints: new { controller = "MyController", action = @"[Aa]ction", requestId = @"-?\d+"});
  </code></pre>
  
  <p>MVC will call the Action(int requestId, string someOtherData) method of the controller, but it will pass 123 as the value of requestId rather than correct value of -123.</p>
  
  <p>Is there a more elegant way handle this issue than:</p>
  
  <pre><code>    //HACK:Fix to handle when MVC annoyingly makes negative values in the url positive
      private int FixNegativeParameter(int id, int paramPos=-1)
      {
          //HACK:Check the raw URL against what MVC passed in.
          string rawUrl = this.Request.RawUrl;
          var urlParts = rawUrl.Split(@"/?".ToCharArray(), StringSplitOptions.None);
          if (paramPos &gt;= 0)
              //Parameter is specified explicitly
              return urlParts[paramPos] == "-" + id ? -id:id;
          //Position not specified.  Looks for any instance of the negative of id
          //HACK:  Not totally reliable if url has multiple int arguments
          return urlParts.Any(up =&gt; ("-" + id) == up) ? -id : id;
      }
  
      [HttpPost]
      public JsonResult Action(int requestId, int profileId)
      {
          requestId = FixNegativeParameter(requestId);
          &lt;remainder of code that accepts negative ids as valid&gt;
      }
  </code></pre>
  
  <p>Possibly a way to change this default behavior?</p>