Answer the question
In order to leave comments, you need to log in
How to send correct POST request C# xNet?
Hello, I ran into a problem that I have not yet been able to solve, and I have not seen solutions for xNet.
I am using the xNet library for C# to work with queries.
I need to send such a POST request:
Pay attention to the parameter params={"network":30, "page":"1"}
But I get it like this =(
It is clear that I need to encode it somehow, because the same request looks like in the URL Decode
And here is the code itself that sends the request
How to solve this
problem ?
Answer the question
In order to leave comments, you need to log in
Developer replied.
Parameters set via AddParam are encoded. So that they are not encoded, you need to use:
dontEscape must be true in this case. Or you can just pass a string to Post.
Greetings.
Try like this:
req.AddParam("act", "getLinksList").AddParam("params", Html.ReplaceEntities(testparam));
Hint POST by default has Content-Type: application/x-www-form- urlencoded (see your screenshot - MimeType is there). If you want to send, emulating a post from a form by a browser, then urlencode cannot be avoided.
If you want a clean body, then set any content-type that suits your soul and rejoice
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question