Re: Not able to login
"Prabudas varadarajan" <[email protected]>
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Thanks a lot for your response.
This my code , using which i am trying to login to a ASP application. The
login fails and asks for relogin.
It will be so helpful if the issue is solved.
import com.meterware.httpunit.*;
public static void main(String[] args) throws Exception {
WebConversation wc = new WebConversation();
HttpUnitOptions.setLoggingHttpHeaders(true);
WebRequest request = new PostMethodWebRequest( "
http://164.99.162.150/admin/Login.aspx");
ClientProperties cp = ClientProperties.getDefaultProperties();
cp.setAcceptCookies(true);
cp.setAcceptGzip(true);
WebResponse response = wc.getResponse( request );
WebForm[] forms = response.getForms(); // getting the login form
WebForm loginForm = forms[0];
loginForm.setParameter("Password","novell");
loginForm.setParameter("UserName","admin");
SubmitButton submitButton = loginForm.getSubmitButtons()[0];
//getting the submit Button
WebResponse firstPage = loginForm.submit(submitButton);
//submitting the form
}
}
On 1/10/07, Prabudas varadarajan <[email protected]> wrote:
>
> HI,
> This is the first time using httpuit.
> I am trying to login to a page, which is done throgh Java Script.
> I am acceppting cookies by using the following code :
>
> ClientProperties cp = ClientProperties.getDefaultProperties ();
> cp.setAcceptCookies(true);
> cp.setAcceptGzip(true);
>
> Also removed js.jar to avoid javascript issues.
>
> Still i am not able to login and getting redirected to login again page.
>
> Can any one kinldy help on this.
>
> Thanks,
> Prabu
> This is the header output of the conversation :
>
> Connecting to 164.99.162.150
> Sending:: POST http://164.99.162.150/admin/Login.aspx
> Sending:: User-Agent: httpunit/1.5
> Sending:: Accept-Encoding: gzip
> Sending:: Content-Type: application/x-www-form-urlencoded
>
> Received from http://164.99.162.150/admin/Login.aspx
> Header:: HTTP/1.1 200 OK
> Header:: Date: Wed, 10 Jan 2007 10:49:27 GMT
> Header:: Server: Apache/2.2.0 (Linux/SUSE)
> Header:: Content-Length: 3952
> Header:: Cache-Control: private
> Header:: Set-Cookie: ASPSESSION=DDA5E08D230BD2B1BBB1DDD1; path=/admin
> Header:: Set-Cookie: test=True; path=/; expires=Fri, 09 Feb 2007 10:49:27
> GMT
> Header:: Keep-Alive: timeout=15, max=100
> Header:: Connection: Keep-Alive
> Header:: Content-Type: text/html; charset=utf-8
> 1
>
> Connecting to 164.99.162.150
> Sending:: POST Login.aspx
> Sending:: User-Agent: httpunit/1.5
> Sending:: Cookie: ASPSESSION=DDA5E08D230BD2B1BBB1DDD1; test=True
> Sending:: Accept-Encoding: gzip
> Sending:: Referer: http://164.99.162.150/admin/Login.aspx
> Sending:: Content-Type: application/x-www-form-urlencoded
>
> Received from http://164.99.162.150/admin/Login.aspx
> Header:: HTTP/1.1 302 Found
> Header:: Date: Wed, 10 Jan 2007 10:49:28 GMT
> Header:: Server: Apache/2.2.0 (Linux/SUSE)
> Header:: Location:
> /admin/Login.aspx?MessageType=Error%3a&MessageText=Your+session+has+been+closed.+Please+log+in.
>
> Header:: Content-Length: 210
> Header:: Cache-Control: private
> Header:: Keep-Alive: timeout=15, max=99
> Header:: Connection: Keep-Alive
> Header:: Content-Type: text/html; charset=utf-8
>
> Connecting to 164.99.162.150
> Sending:: GET
> /admin/Login.aspx?MessageType=Error%3a&MessageText=Your+session+has+been+closed.+Please+log+in.
> Sending:: User-Agent: httpunit/1.5
> Sending:: Cookie: ASPSESSION=DDA5E08D230BD2B1BBB1DDD1; test=True
> Sending:: Accept-Encoding: gzip
> Sending:: Referer: http://164.99.162.150/admin/Login.aspx
>
> Received from
> http://164.99.162.150/admin/Login.aspx?MessageType=Error%3a&MessageText=Your+session+has+been+closed.+Please+log+in
> .
> Header:: HTTP/1.1 200 OK
> Header:: Date: Wed, 10 Jan 2007 10:49:28 GMT
> Header:: Server: Apache/2.2.0 (Linux/SUSE)
> Header:: Content-Length: 4156
> Header:: Cache-Control: private
> Header:: Set-Cookie: ASPSESSION=4E2B89C313E9BE9B59013A78; path=/admin
> Header:: Set-Cookie: test=True; path=/; expires=Fri, 09 Feb 2007 10:49:28
> GMT
> Header:: Keep-Alive: timeout=15, max=98
> Header:: Connection: Keep-Alive
> Header:: Content-Type: text/html; charset=utf-8
>
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop