Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Accepting application/x-www-urlencode format data

Accepting application/x-www-urlencode format data

Scheduled Pinned Locked Moved ASP.NET
jsonhelplearningcsharpasp-net
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    R1911
    wrote on last edited by
    #1

    I'm just learning Asp.net Web APIs. It was smooth until it's simple application/json type headers to deal with. But now I'm trying to submit data with Content-Type:application/x-www-urlencode , but it's been really tough to get it working. I tried different things, right from using [FromBody] attrib to "AliasBinder" etc. But nothing seem to work. The API is dead simple , The code looks like: class Point { int x {get;set;} int y {get;set;} } [httpPost] public string getValues(Point pt_in) { Diagnostics.Trace.TraceInfo(pt_in.x); //Also tried using HttpUtility.Encode/Decode to read pt_in.x } that's it. When I try from postman, different combo, different errors: "Message": "The request contains an entity body but no Content-Type header. The inferred media type 'application/octet-stream' is not supported for this resource." And at times (during various trial), I get 415 unsupported media type* error I just need a simple Asp.net Web API example, where we are able to push Data as x-www-urlencode format & read the values inside the API. Any help please? thanks Sum

    Richard DeemingR 1 Reply Last reply
    0
    • R R1911

      I'm just learning Asp.net Web APIs. It was smooth until it's simple application/json type headers to deal with. But now I'm trying to submit data with Content-Type:application/x-www-urlencode , but it's been really tough to get it working. I tried different things, right from using [FromBody] attrib to "AliasBinder" etc. But nothing seem to work. The API is dead simple , The code looks like: class Point { int x {get;set;} int y {get;set;} } [httpPost] public string getValues(Point pt_in) { Diagnostics.Trace.TraceInfo(pt_in.x); //Also tried using HttpUtility.Encode/Decode to read pt_in.x } that's it. When I try from postman, different combo, different errors: "Message": "The request contains an entity body but no Content-Type header. The inferred media type 'application/octet-stream' is not supported for this resource." And at times (during various trial), I get 415 unsupported media type* error I just need a simple Asp.net Web API example, where we are able to push Data as x-www-urlencode format & read the values inside the API. Any help please? thanks Sum

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      Sending HTML Form Data in ASP.NET Web API: Form-urlencoded Data | Microsoft Docs[^]


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      R 1 Reply Last reply
      0
      • Richard DeemingR Richard Deeming

        Sending HTML Form Data in ASP.NET Web API: Form-urlencoded Data | Microsoft Docs[^]


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        R Offline
        R Offline
        R1911
        wrote on last edited by
        #3

        Thanks will try it out. most of the things explained there, I did try. But let me verify it well and get back. thanks.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups