login about faq

i have username: cuộc tình and can not post to login web site because chilkat encode username difirent with Live HTTP Headers

log post data chilkat

vb_login_username=cu%2526%25237897%253Bc%2Bt%25ECnh&vb_login_password_hint=Password&vb_login_password=123456&s=5730fcbc71c73e159460dcaaba30c647&securitytoken=guest&do=login&vb_login_md5password=e10adc3949ba59abbe56e057f20f883e&vb_login_md5password_utf=e10adc3949ba59abbe56e057f20f883e&s=5730fcbc71c73e159460dcaaba30c647&do=login

log postdata live HTTP Headers

vb_login_username=cu%26%237897%3Bc+t%ECnh&vb_login_password_hint=Password&vb_login_password=123456&s=5730fcbc71c73e159460dcaaba30c647&securitytoken=guest&do=login&vb_login_md5password=e10adc3949ba59abbe56e057f20f883e&vb_login_md5password_utf=e10adc3949ba59abbe56e057f20f883e

my code

Chilkat.HttpRequest post = new Chilkat.HttpRequest();
        post.AddParam("vb_login_username", "cuộc tình");
        post.AddParam("vb_login_password_hint", "Password");
        post.AddParam("vb_login_password", "123456");
        post.AddParam("s", "5730fcbc71c73e159460dcaaba30c647");
        post.AddParam("securitytoken", "guest");
        post.AddParam("do", "login");
        post.AddParam("vb_login_md5password", "e10adc3949ba59abbe56e057f20f883e");
        post.AddParam("vb_login_md5password_utf", "e10adc3949ba59abbe56e057f20f883e");
        post.HttpVerb = "POST";
        post.UsePost();
        Chilkat.HttpResponse html = http.PostUrlEncoded("http://forums.vwvortex.com/login.php?s=5730fcbc71c73e159460dcaaba30c647&do=login", post);
        string htmlretur = html.BodyStr;
        http.SendCookies = true;
        richTextBox1.Text = htmlretur;

asked Jul 01 '15 at 22:46

thanh858036's gravatar image

thanh858036
33

edited Jul 02 '15 at 00:08


Maybe the Charset property will do the trick? e.g. post.Charset = "utf-8"

From the documentation:

Charset As String

Controls the character encoding used for HTTP request parameters for POST requests. The default value is the ANSI charset of the computer. The charset should match the charset expected by the form target.

The "charset" attribute is only included in the Content-Type header of the request if the SendCharset property is set to 1.

link

answered Jul 02 '15 at 08:44

jpbro's gravatar image

jpbro ♦
1.1k2618

i add post.Charset = "utf-8" but post param username not encoding char same as cu%26%237897%3Bc+t%ECnh

(Jul 02 '15 at 12:26) thanh858036

Hi thanh858036 (& jpbro),

Fyi, few days back I tried to POST Chinese character string in one of the param. You may search for my query in this forum. I am able to send UTF-8 string partially successfully (odd number of chinese characters was sent Empty !!!). Even number of Chinese characters without issue..strange ...

However, after reading the above tip from jbpro (Hi jpbro, Thanks again !)...It works beautifully for my case without the need to use Ckstring !

Below is my VC code, hope that it will help you....

BengRequest.put_HttpVerb("POST");

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

BengRequest.put_Charset("utf-8"); // *** Magic tip ! ****

BengHttp.put_RedirectVerb("");

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

BengRequest.AddHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");

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

BengRequest.AddHeader("Referer","http://www.xxxxxx.com/");

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

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

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

BengRequest.AddHeader("Host",szDomain);

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

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

BengRequest.AddParam("tbUserAccount",szUserAccount);

BengRequest.AddParam("tbUserPwd",szUserPwd);

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

BengRequest.AddParam("nextAutoLogin","1");

BengRequest.AddParam("re","http://www.xxxxxxxx.com");

BengResponse = BengHttp.SynchronousRequest(szDomain,80,false,BengRequest);

That's all.

Best regards Dragon

link

answered Jul 03 '15 at 04:29

dragon's gravatar image

dragon
333711

i set charset utf-8 but can not login success

Chilkat.HttpRequest post = new Chilkat.HttpRequest();
    post.Charset = "utf8";// added utf-8
    post.AddParam("vb_login_username", "cuộc tình");
    post.AddParam("vb_login_password_hint", "Password");
    post.AddParam("vb_login_password", "123456");
    post.AddParam("s", "5730fcbc71c73e159460dcaaba30c647");
    post.AddParam("securitytoken", "guest");
    post.AddParam("do", "login");
    post.AddParam("vb_login_md5password", "e10adc3949ba59abbe56e057f20f883e");
    post.AddParam("vb_login_md5password_utf", "e10adc3949ba59abbe56e057f20f883e");
    post.HttpVerb = "POST";
    post.UsePost();
    Chilkat.HttpResponse html = http.PostUrlEncoded("http://forums.vwvortex.com/login.php?s=5730fcbc71c73e159460dcaaba30c647&do=login", post);
    string htmlretur = html.BodyStr;
    http.SendCookies = true;
    richTextBox1.Text = htmlretur;
link

answered Jul 03 '15 at 05:19

thanh858036's gravatar image

thanh858036
33

who can help me please

link

answered Jul 05 '15 at 10:55

thanh858036's gravatar image

thanh858036
33

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:

×186

Asked: Jul 01 '15 at 22:46

Seen: 1,406 times

Last updated: Jul 05 '15 at 10:55

powered by OSQA