Hello,

I am new to HttpClient.  I tried to follow
FormLoginDemo to log in the a web site.  After
entering the user name and password, the site is
redirected to a new url using the javascript.  The
program uses the PostMethod to login to the web site
successfully since the cookies are created.  But it
can not use GetMethod to redirect to the page using
the URL from returned javascript.  The "HTTP/1.1 404
Not Found" was found in the log file.  But I was able
to login the web site using the re-direct URL from
javascripts using the web browser.  Here are part of
codes:

 static final String LOGON_SITE = "www.iddb.com";
 static final int    LOGON_PORT = 80;

        HttpClient client = new HttpClient();
       
client.getHostConfiguration().setHost(LOGON_SITE,
LOGON_PORT, "http");
       
client.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
        
        PostMethod authpost = new
PostMethod("/iddb3/iddb3_2/login.verify");
        // Prepare login parameters
        NameValuePair userid   = new
NameValuePair("username_in", "user");
        NameValuePair password = new
NameValuePair("password_in", "password");
        NameValuePair autologin = new
NameValuePair("autologin", "Y");
        NameValuePair i_login = new
NameValuePair("i_login", "Y");
           
        authpost.setRequestBody( 
          new NameValuePair[] { userid, password,
autologin, i_login});
 
        int statuscode2 =
client.executeMethod(authpost);

        GetMethod redirect1 = new
GetMethod("/iddb3/iddb3_2/alerts.get_alert?v_alert_type=Drug&v_clear_trail=Y
");
        
        c1.executeMethod(redirect1 );

The log file is attached.

Thank you very much for your help !

David



        
                
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to