login about faq

Hi Chilkat,

I tried to send a Http POST (without url encoding for the params), but when I looked at the log, the request become a GET instead !

As I understood from the following link, content-type should be set to "text/namevalue".

http://www.example-code.com/vcpp/paypal_creditcardpayment.asp

I tried both

a. Request.put_ContentType("text/namevalue");

b. Request.AddHeader("Content-Type","text/namevalue");

still it doesn't work ie. GET is sent instead of POST.

Latest library is used ie.v9.5.0.50 VC++ 9.0 / win32 (VS2008).

I believe it is a bug.

Fya.

Best regards

Dragon

asked Jun 22 '15 at 20:28

dragon's gravatar image

dragon
333711


Check out the documentation of the RedirectVerb property (I think it will help):

RedirectVerb Indicates the HTTP verb, such as GET, POST, PUT, etc. to be used for a redirect when the FollowRedirects property is set to 1. The default value of this property is "GET". This will produce the same behavior as a web browser (such as FireFox). If this property is set to the empty string, then it will cause the same verb as the original HTTP request to be used.

Note: Prior to version 9.5.0.44, the default value of this property was the empty string.

If you explicitly clear the RedirectVerb property, do you get a POST after redirect?

link

answered Jun 23 '15 at 19:11

jpbro's gravatar image

jpbro ♦
1.1k2618

Hi jpbro,

Sorry for my late reply and thanks again for your fast response !

I looked at the log again. My mistake ! I missed out the detail.

Initially, a Correct POST was sent. However, the response received is :

HTTP/1.1 302 Moved Temporarily

Then, the problem appeared, the POST was resend....

It become a GET....

Hence, need to test on a website which will reply "HTTP/1.1 302 Moved Temporarily" to see the issue.

Thanks.

link

answered Jun 23 '15 at 18:46

dragon's gravatar image

dragon
333711

Hi jpbro,

Bingo ! Yes, you are right !

I believe that I have to read the documentation thoroughly next time.

Thanks for your great help !

Best regards Dragon

link

answered Jun 23 '15 at 20:08

dragon's gravatar image

dragon
333711

Great, glad to help! If you take a second to click the checkmark icon beside the answer above to accept it, you will help others who encounter the same problem find the solution in the future. Cheers!

(Jun 24 '15 at 09:48) jpbro ♦

Hi jpbro,

Ok, done !

Thanks again !

Best regards Dragon

link

answered Jun 24 '15 at 20:34

dragon's gravatar image

dragon
333711

Did you call UsePost on the CkHttpRequest object (though deprecated, I believe it still works), or event better set the HttpVerb property of the CkHttpRequest object to "POST"?

link

answered Jun 22 '15 at 20:32

jpbro's gravatar image

jpbro ♦
1.1k2618

edited Jun 22 '15 at 20:32

Hi jbro,

Thanks for your fast reply.

Yes, I did.

Request.put_HttpVerb("POST");

Request.put_Path("/login.php");

Request.put_ContentType("text/namevalue");

Request.AddHeader("Accept","application/json, text/javascript, /; q=0.01");

Request.AddHeader("X-Requested-With","XMLHttpRequest");

Request.AddHeader("Accept-Language","zh-CN");

Request.AddHeader("User-Agent","Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko");

Request.AddHeader("Connection","Keep-Alive");

Request.AddHeader("Host",szDomain);

Request.AddHeader("Pragma","no-cache");

Request.AddParam("act","login");

Request.AddParam("tbUserAccount",szUserAccount);

Request.AddParam("tbUserPwd",szUserPwd);

Request.AddParam("tbCode","");

link

answered Jun 22 '15 at 21:59

dragon's gravatar image

dragon
333711

Hmmm, I'm not sure - just tried the same sample (with VB6/ActiveX though) and Chilkat 9.5.0.50 and I get a POST header when I examine the return value of req.GenerateRequestText. I tried both UsePost and HttpVerb = "POST", and both seem to generate a POST request. Sorry I can't be of more help!

(Jun 23 '15 at 09:31) jpbro ♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×26

Asked: Jun 22 '15 at 20:28

Seen: 785 times

Last updated: Jun 24 '15 at 20:34

powered by OSQA