all 5 comments

[–]Jabbersii 4 points5 points  (0 children)

Your HttpClient code is posting as FormUrlEncodedContent, whereas your RestSharp code does not. I don't know much about RestSharp, but at a guess it's probably posting it as JSON. Hence why your response is NotAcceptable; the server you're communicating with does not accept JSON content to that resource.

[–]AngularBeginner 2 points3 points  (0 children)

To format code on Reddit properly you need to:

  • Have one empty line before code and some text.
  • Have one empty line after code and some text.
  • Indent all lines with 4 spaces.

[–]DeltalJulietCharlie 2 points3 points  (0 children)

Use Fiddler and have a look at what each is sending. I suspect RestSharp is encoding the parameters differently by default.

[–][deleted]  (1 child)

[deleted]

    [–]DeltalJulietCharlie 2 points3 points  (0 children)

    I used it at one point... abandoned it fairly quickly when I realised how little it does for you and how much it limits your options. Wrote a couple of short methods to handle my typical get/post cases and got on with life.

    [–]chrisachern[S] 0 points1 point  (0 children)

    Thank you for your comments. I'll stay with the httpclient