login about faq

Hi, i want to make a very basic login to get my messages from a forum i use, i got the OK from the forum Administrator to use automatic software to login to my account and i'm trying to do this: Chilkat.Http http = new Chilkat.Http(); http.UnlockComponent("xxxxxxxxxxxxxxx"); http.SessionLogFilename = "c:/temp/httpSessionLog.txt"; http.CookieDir = "memory"; http.SaveCookies = true; http.MimicFireFox = true; http.FollowRedirects = true; http.SetRequestHeader("Accept-Encoding", "gzip, deflate"); http.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded"); http.SetRequestHeader("Accept-Language", "en-us"); http.SetRequestHeader("Referer", "http://forums.vwvortex.com/forum.php"); http.SetRequestHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"); http.SetRequestHeader("Accept", "application/x-shockwave-flash, image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, /"); Chilkat.HttpRequest post = new Chilkat.HttpRequest(); post.AddParam("s", ""); post.AddParam("securitytoken", "guest"); post.AddParam("vb_login_md5password", ""); post.AddParam("vb_login_md5password_utf", ""); post.AddParam("vb_login_password", "yyyyyyy"); //my password post.AddParam("vb_login_password_hint", "Password"); post.AddParam("vb_login_username", "xxxxxxxx"); //my username post.HttpVerb = "POST"; post.UsePost(); post.ContentType = "application/x-www-form-urlencoded"; Chilkat.HttpResponse html = http.PostUrlEncoded("http://forums.vwvortex.com/login.php?do=login", post); string htmlretur = html.BodyStr; var a = http.LastErrorText; var b = http.LastHeader; http.SendCookies = true; // everything seems to be OK until here, i get the welcome message and everyting, but when i try to mavigate to another page i am not logged in... I think it's some cookie problem.. ret = http.QuickGetStr("http://forums.vwvortex.com/"); a = http.LastErrorText; b = http.LastHeader;

here is the httpsessionlog http://pastebin.com/kp7pf8Kn here is the LastErrorText for the post

http://pastebin.com/3Et3tLCX

ChilkatLog: PostUrlEncoded: DllDate: Dec 12 2012 UnlockPrefix: DAVIDHHttp Username: EVENTS:Administrator Architecture: Little Endian; 32-bit Language: .NET 4.0 VerboseLogging: 0 url: http://forums.vwvortex.com/login.php?do=login sessionLogFilename: c:/temp/httpSessionLog.txt RequestData: HttpVersion: 1.1 Verb: POST Path: / Charset: windows-1252 SendCharset: 0 MimeHeader: Content-Type: application/x-www-form-urlencoded RequestParams: RequestItem: name: s value: --RequestItem RequestItem: name: securitytoken value: guest --RequestItem RequestItem: name: vb_login_md5password value: --RequestItem RequestItem: name: vb_login_md5password_utf value: --RequestItem RequestItem: name: vb_login_password value: yyyyyyyyy --RequestItem RequestItem: name: vb_login_password_hint value: Password --RequestItem RequestItem: name: vb_login_username value: xxxxxxxx --RequestItem --RequestParams --RequestData httpConnect: hostname: forums.vwvortex.com port: 80 ssl: 0 Need to establish connection to the HTTP server... ConnectTimeoutMs_1: 120000 calling ConnectSocket2 IPV6 enabled connect with NO heartbeat. connectingTo: forums.vwvortex.com resolveHostname1: dnsCacheLookup: forums.vwvortex.com Resolving domain name (IPV4) --resolveHostname1 GetHostByNameHB_ipv4: Elapsed time: 171 millisec myIP_1: 172.158.18.252 myPort_1: 1500 connect successful (1) Turning on TCP_NODELAY. socketOptions: SO_SNDBUF: 8192 SO_RCVBUF: 8192 TCP_NODELAY: 1 --socketOptions Connected --httpConnect connectTime1: Elapsed time: 500 millisec sendRequestGetResponse_1: sendRequest: Adding Host header... host: forums.vwvortex.com port: 80 Auto-adding any accumulated cookies. CookieDir: memory CookieDomain: forums.vwvortex.com CookiePath: /login.php LoadCookieJar: Path: /login.php GetDomainCookiesXml: CookieDir: memory Domain: forums.vwvortex.com HashKey: vwvortex_com.xml No cookies exist yet. --GetDomainCookiesXml --LoadCookieJar No cookie jar found. --sendRequest sendRequestTime: Elapsed time: 0 millisec ---- Reading HTTP Response ---- readResponse2_4: ConnectionRespHdr: close fetchNonSslResponseData2_4: Reading chunked response --fetchNonSslResponseData2_4 Closing HTTP connection because of Connection:close header. (or proxy-connection:close header) Saving cookies... defaultCookieDomain: forums.vwvortex.com Cookie: Name: bb_sessionhash Value: e972b78dd358b4a5da6814c558be054f Domain: forums.vwvortex.com Path: / Expire: --Cookie SaveCookie: CookieDir: memory Domain: forums.vwvortex.com HashKey: vwvortex_com.xml --SaveCookie Cookie: Name: bb_lastvisit Value: 1368033680 Domain: forums.vwvortex.com Path: / Expire: Thu, 08-May-2014 17:21:20 GMT --Cookie SaveCookie: CookieDir: memory Domain: forums.vwvortex.com HashKey: vwvortex_com.xml --SaveCookie Cookie: Name: bb_lastactivity Value: 0 Domain: forums.vwvortex.com Path: / Expire: Thu, 08-May-2014 17:21:20 GMT --Cookie SaveCookie: CookieDir: memory Domain: forums.vwvortex.com HashKey: vwvortex_com.xml --SaveCookie Cookie: Name: SERVERID Value: Domain: forums.vwvortex.com Path: / Expire: Thu, 01-Jan-1970 00:00:01 GMT --Cookie SaveCookie: CookieDir: memory Domain: forums.vwvortex.com Cookie is expired. Not saving... expiration: Thu, 01-Jan-1970 00:00:01 GMT bDateParsed: 1 parsedExpDateTime: Thu, 01 Jan 1970 00:00:01 GMT --SaveCookie readResponseTime: Elapsed time: 421 millisec --readResponse2_4 processResponse_3: responseStatus: 200 --processResponse_3 --sendRequestGetResponse_1 Success. --PostUrlEncoded --ChilkatLog

and this is the LastErrorText for the next GET, the result html is OK but i am not logged in...

http://pastebin.com/mKV1EPym

ChilkatLog: QuickGetStr: DllDate: Dec 12 2012 UnlockPrefix: DAVIDHHttp Username: EVENTS:Administrator Architecture: Little Endian; 32-bit Language: .NET 4.0 VerboseLogging: 0 QuickReq: url: http://forums.vwvortex.com/ QuickGetToOutput_OnExisting: qGet_1: simpleHttpRequest_3: httpMethod: GET requestUrl: http://forums.vwvortex.com/ Connecting to web server... httpServer: forums.vwvortex.com port: 80 ConnectTimeoutMs_1: 120000 calling ConnectSocket2 IPV6 enabled connect with NO heartbeat. connectingTo: forums.vwvortex.com resolveHostname1: dnsCacheLookup: forums.vwvortex.com dnsCacheHit: 199.193.245.42 --resolveHostname1 GetHostByNameHB_ipv4: Elapsed time: 0 millisec myIP_1: 172.158.18.252 myPort_1: 1503 connect successful (1) Turning on TCP_NODELAY. socketOptions: SO_SNDBUF: 8192 SO_RCVBUF: 8192 TCP_NODELAY: 1 --socketOptions connectElapsedMs: 172 -- BuildFireFoxGetRequest -- Auto-adding any accumulated cookies. CookieDir: memory CookieDomain: forums.vwvortex.com CookiePath: / LoadCookieJar: Path: / GetDomainCookiesXml: CookieDir: memory Domain: forums.vwvortex.com HashKey: vwvortex_com.xml --GetDomainCookiesXml --LoadCookieJar AddingCookie: bb_sessionhash=e972b78dd358b4a5da6814c558be054f; bb_lastvisit=1368033680; bb_lastactivity=0 sendElapsedMs: 0 Saving cookies... defaultCookieDomain: forums.vwvortex.com Cookie: Name: bb_sessionhash Value: ab2c97b9bfadc43b0280ba27584afab9 Domain: forums.vwvortex.com Path: / Expire: --Cookie SaveCookie: CookieDir: memory Domain: forums.vwvortex.com HashKey: vwvortex_com.xml --SaveCookie Cookie: Name: bb_lastactivity Value: 0 Domain: forums.vwvortex.com Path: / Expire: Thu, 08-May-2014 17:22:43 GMT --Cookie SaveCookie: CookieDir: memory Domain: forums.vwvortex.com HashKey: vwvortex_com.xml --SaveCookie Cookie: Name: SERVERID Value: Domain: forums.vwvortex.com Path: / Expire: Thu, 01-Jan-1970 00:00:01 GMT --Cookie SaveCookie: CookieDir: memory Domain: forums.vwvortex.com Cookie is expired. Not saving... expiration: Thu, 01-Jan-1970 00:00:01 GMT bDateParsed: 1 parsedExpDateTime: Thu, 01 Jan 1970 00:00:01 GMT --SaveCookie StatusCode: 200 StatusText: OK Reading response body... fetchNonSslResponseData2_2: Reading chunked response --fetchNonSslResponseData2_2 readResponseElapsedMs: 922 CompressedSize: 8544 Got connection:close header --simpleHttpRequest_3 --qGet_1 --QuickGetToOutput_OnExisting --QuickReq responseSize: 32457 responseContentType: text/html; charset=ISO-8859-1 This is a text response... ResponseHdrCharset: ISO-8859-1 Converting to utf-8 charset. ConvertFromCodePage: 28591 NumUtf8Bytes: 32461 Success. --QuickGetStr --ChilkatLog

Any idea why ? Or what am i doing wrong? i tested with my browser, Active Scripting Disabled with both Firefox and IE 8 and it works.

I recorded my actions and i get this, Recorded with IE 8:

POST /login.php?do=login HTTP/1.1 Accept: application/x-shockwave-flash, image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, / Referer: http://forums.vwvortex.com/forum.php Accept-Language: en-us User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E) Content-Type: application/x-www-form-urlencoded Accept-Encoding: gzip, deflate Host: forums.vwvortex.com Content-Length: 168 Connection: Keep-Alive Cache-Control: no-cache Cookie: bb_lastvisit=1368022979; bb_lastactivity=0

vb_login_username=xxxxxxxxxxxx&vb_login_password_hint=Password&vb_login_password=yyyyyyyyyy&s=&securitytoken=guest&do=login&vb_login_md5password=&vb_login_md5password_utf=

received:

HTTP/1.1 200 OK Content-Encoding: gzip Vary: Accept-Encoding Transfer-Encoding: chunked Date: Wed, 08 May 2013 14:23:27 GMT Server: LiteSpeed Connection: close X-Powered-By: PHP/5.3.2 Set-Cookie: bb_lastactivity=0; expires=Thu, 08-May-2014 14:23:27 GMT; path=/ Set-Cookie: bb_sessionhash=09a44477f40262cab54b2cfa7f3cb07f; path=/; HttpOnly Cache-Control: private Pragma: private Content-Type: text/html; charset=ISO-8859-1 Set-Cookie: SERVERID=; Expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/

683 gziped html here ...

redirect to : http://forums.vwvortex.com/forum.php My browser sends :

GET /forum.php HTTP/1.1 Accept: application/x-shockwave-flash, image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, / Accept-Language: en-us User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E) Accept-Encoding: gzip, deflate Host: forums.vwvortex.com Connection: Keep-Alive Cookie: bb_lastvisit=1368022979; bb_lastactivity=0; bb_sessionhash=09a44477f40262cab54b2cfa7f3cb07f

Receive :

HTTP/1.1 200 OK Content-Encoding: gzip Vary: Accept-Encoding Transfer-Encoding: chunked Date: Wed, 08 May 2013 14:23:30 GMT Server: LiteSpeed Connection: close X-Powered-By: PHP/5.3.2 Cache-Control: private Pragma: private Content-Type: text/html; charset=ISO-8859-1 Set-Cookie: SERVERID=; Expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/

1000  Gzip content here ....

and i remain logged in for example if i go to:

GET /forumdisplay.php?5080-The-Car-Lounge HTTP/1.1 Accept: application/x-shockwave-flash, image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, / Referer: http://forums.vwvortex.com/forum.php Accept-Language: en-us User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E) Accept-Encoding: gzip, deflate Host: forums.vwvortex.com Connection: Keep-Alive Cookie: bb_lastvisit=1368022979; bb_lastactivity=0; bb_sessionhash=09a44477f40262cab54b2cfa7f3cb07f

and the response :

HTTP/1.1 200 OK Content-Encoding: gzip Vary: Accept-Encoding Transfer-Encoding: chunked Date: Wed, 08 May 2013 15:06:42 GMT Server: LiteSpeed Connection: close X-Powered-By: PHP/5.3.2 Set-Cookie: bb_sessionhash=192be09d402793184ef59a400efd05bf; path=/; HttpOnly Set-Cookie: bb_lastvisit=1368022979; expires=Thu, 08-May-2014 15:06:42 GMT; path=/ Set-Cookie: bb_lastactivity=0; expires=Thu, 08-May-2014 15:06:42 GMT; path=/ Cache-Control: private Pragma: private Content-Type: text/html; charset=ISO-8859-1 Set-Cookie: SERVERID=; Expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/

html here and i am logged in...

asked May 08 '13 at 13:50

maryanncarper72's gravatar image

maryanncarper72
1122

If you put your code and result blocks in <pre></pre> tags it will be easier to read in this forum.

(May 08 '13 at 14:25) jpbro ♦

here is the pastebin version of this question because is hard to follow ...

http://pastebin.com/xG1ceUFK

link

answered May 08 '13 at 13:53

maryanncarper72's gravatar image

maryanncarper72
1122

Never mind, it works now, after sniffing all traffic with WireShark i found the missing link :) So you can delete this question. Thanks

link

answered May 09 '13 at 11:28

maryanncarper72's gravatar image

maryanncarper72
1122

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:

×35
×26
×14
×9
×5

Asked: May 08 '13 at 13:50

Seen: 8,020 times

Last updated: May 09 '13 at 11:28

powered by OSQA