Hi Ian, the trick is in the onload="document.AUTOSUBMIT.submit()" part of the HTML page. A browser will detect this handler and execute the JavaScript code in it after loading the document. That particular JavaScript creates a followup request, sending the data in the hidden input field "SMPostPreserve" to the URL specified in the action attribute of the <form> tag. I find it particularily ugly that the URL itself also contains a query string, but that is not your problem.
The problem here is that the redirect after a login is handled completely on the application/HTML/JavaScript level and is in no way visible on the HTTP level. Therefore, it can not be automatically handled by the HttpClient. The easiest way for you to go on is to handle the page in your application. Search for the action= part and extract the URL. Then search for the value= part in the input field named SMPostPreserve. Create a new post request to the target URL, add the parameter from the hidden input field, and hope that it works. Unfortunately, your code may be broken at any time if that redirect page on the server undergoes significant changes. hope that helps, Roland Ian Zhang <[EMAIL PROTECTED]> 06.09.2004 22:29 Please respond to "Commons HttpClient Project" To Commons HttpClient Project <[EMAIL PROTECTED]> cc Subject Use HttpClinet to login a https site. Hi, Everyone. I am not sure if this mailing list is the place asking for help. If it is not, sorry. === I use HttpClient 2.01 to login a site using form (post method) login. I got the following response message. It looks like it continue to processing. The Netscape or IE will automatically be forwarded (or redirect). How do I handle using HttpClient? It is a https site. I have the user id and password to use a form login. The status is 200. Is the a forwarding, redirect or proxy problem? Thanks for the help. -Ian statuscode:200 HTTP/1.1 200 <HTML><HEAD><TITLE></TITLE></HEAD><BODY onLoad="document.AUTOSUBMIT.submit();">This page is used to hold your data while you are being authorized for your request.<BR><BR>You will be forwarded to continue the authorization process. If this does not happen automatically, please click the Continue button below.<FORM NAME="AUTOSUBMIT" METHOD="POST" ACTION=" http://login.xyz.com/index.html?TYPE=100663297&REALMOID=06-000579b4-b1f3-1eb9-82ee-800906e3fd70&GUID=&SMAUTHREASON=0&METHOD=POST&SMAGENTNAME=$SM$bOzL%2bZOmlvhRHjLIWXIVOdHzNtsPM5ZpPQVpUIuyFp2R8Pgvr8vzWw%3d%3d&TARGET=$SM$https%3a%2f%2ffdtvs%2enextel%2ecom%2fservlet%2fServletNavigator "><INPUT TYPE="HIDDEN" NAME="SMPostPreserve" VALUE="ajdiRWkrNkhUUllCU2hveWNMZmZxTVNNTE1RRjhrYU5pOVNpcFlOWUd4UzlqRUYwd0x2R2t1eGJHRGpVeWthT3I1RUhtdm1ZMU8vNXJqVzdBNkkwQXZaWEJERGh5TEtWd3BHY3VJK2lYWFNYQlBid0ZSOGFBcFIxd3BPYllTd0xaZUR5VFFjZExiRHhDZGR4S2FOaGJjUmFQRGRFZEZzVnZFVDVGS1JYdWdnaC9TUXZOZDFDZjkzUThOSVV1Y1NTNHhORXZvYTdaKzFQUEJaQzdPejhadz09"><INPUT TYPE="SUBMIT" VALUE="Continue"></FORM></BODY></HTML> ===== Ian Zhang [EMAIL PROTECTED] __________________________________ Do you Yahoo!? Y! Messenger - Communicate in real time. Download now. http://messenger.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
