Click here to Skip to main content
15,175,960 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Can anyone tell me what is wrong with this HTTP POST packet? The web server seems to be ingoring it.

Prior to URLEncoding and without Base64 encoded data:
"POST /Default.aspx HTTP/1.1\r\nHost:\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 17\r\n\r\ndata=TestDataSend"

Post encoding:

The end of the packet ("data%3dVGVzdERhdGFTZW50") is data=TestDataSend which is what I am trying to send.

If you are wondering, this is for an embedded application. I am trying not to use the entire HTTP protocol and just use a simplified POST.

Thanks for any insight.
Updated 27-Jul-11 12:56pm
Christian Graus 27-Jul-11 14:00pm
You can't use ASP.NET with C++
willworknow1 27-Jul-11 14:41pm
I do understand that. The reason for the C++ tag is someone with C++ knowledge could also know the answer to this question. They might have more intimate knowledge of the HTTP protocol.
Sergey Alexandrovich Kryukov 27-Jul-11 17:35pm
You could use C++/CLI or mixed-mode solution with ASP.NET, so knowledge of C++ people might help.

1 solution

The server should accept the "Prior to URLEncoding" snippet. Cause thats correct. You have to encode the post data only.
willworknow1 28-Jul-11 15:17pm
Is that just like it is...with spaces, forward slashes etc? The above still does not seem to be working for me.
mbue 28-Jul-11 16:24pm
Cant recognize the kind of the data encoding. The http header has not to be encoded - except the location (path and host when neccessary [1]) the data (urlencoded) has to be encoded in percent encoding [2].

willworknow1 29-Jul-11 18:34pm
This is what worked.
"POST /Default.aspx?data=VGVzdERhdGE%3d HTTP/1.1\r\nHost:\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 0\r\n\r\n";

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900