S
S
skvoshiz2015-11-03 06:51:50
.NET
skvoshiz, 2015-11-03 06:51:50

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:
70e7dacc8ea24a90bff9b7d5581d2548.PNGPay attention to the parameter params={"network":30, "page":"1"}
But I get it like this =(
d489c4c4e68f48239aaf231d450de158.PNG
It is clear that I need to encode it somehow, because the same request looks like in the URL Decode
104243021a0e484ba5b25312753c6f3e.PNG
And here is the code itself that sends the request
f3601de37f064b84b75521bc187c4872.PNG
How to solve this
problem ?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
skvoshiz, 2015-11-03
@skvoshiz

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.

G
georgich, 2015-11-03
@georgich

Greetings.
Try like this:

req.AddParam("act", "getLinksList").AddParam("params", Html.ReplaceEntities(testparam));

J
justmara, 2015-11-03
@justmara

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 question

Ask a Question

731 491 924 answers to any question