title: ASP.NET Deserialize Form POST with unusual key names into proper DataContract model?
body: <p>I'm somewhat new to C# and ASP.NET, and I've been tasked with replacing an application with a new ASP.NET Core MVC API service. I also have a legacy application that needs to POST some data into it, but I have no control over it's code and cannot change it's behavior. It wants to send data as <code>application/x-www-form-urlencoded</code>, and with uppercased parameter names containing "invalid" characters when mapped back to a POCO data contract object, such as <code>.</code>, or names starting with numbers.</p>
  
  <p>An example request from the legacy app might look like:</p>
  
  <pre><code>POST /something HTTP/1.0
  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  Accept-Language: en-US,en;q=0.5
  Accept-Encoding: gzip, deflate
  Content-Type: application/x-www-form-urlencoded
  Content-Length: 42
  
  USERNAME=somebody&amp;ACCOUNT=123&amp;APP.SESSID=acbd18db4cc2f85cedef654fccc4a4d8&amp;1STCOLOR=BLUE
  </code></pre>
  
  <p>Since I cannot, and somewhat don't want, to create a DataContract model like this invalid code, I'm not sure how to proceed.</p>
  
  <pre><code>class InputModel
  {
      public string USERNAME { get; set; }
      public int ACCOUNT { get; set; }
      public string APP.SESSID { get; set; }
      public string 1STCOLOR { get; set; }
  }
  </code></pre>
  
  <p>Preferably, I'd like to humanize the data model member names where possible, (eg, <code>APP.SESSID</code> to <code>ApplicationSessionID</code>), and be able to bind the legacy parameter names to the humanized member names on deserialization of the form data, or during model binding, or something.</p>
  
  <p>I just don't know where to look or what to search for in the ASP.NET Core code to help me determine what I should be doing to override the default form deserialization behavior. Can anyone with experience here help? Thanks for your time!</p>