Re: Not able to login
"Prabudas varadarajan" <[email protected]>
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Jay,
Thanks a lot for ur response.
This is the code of the login page.
There is one hidden parameter __VIEWSTATE in the page source.
Can you kindly have a look at this.
Thanks,
Prabu
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<title>
Administrator
</title>
<link rel="SHORTCUT ICON" href="images/N_url_shortcut.ico">
<style type="text/css">
@import url(css/Admin.css);
@import url(css/Login.css);
</style>
<script language="javascript">
<!--
// set the focus on the password text box, unless no username exists
function SetFocus()
{
var tb = document.getElementById("UserName");
if (tb.value.length > 0)
{
document.getElementById("Password").focus();
}
else
{
tb.focus();
}
}
// on load
window.onload = SetFocus;
-->
</script>
</head>
<body>
<form name="_ctl0" method="post" action="Login.aspx" id="_ctl0">
<input type="hidden" name="__VIEWSTATE"
value="DA0ADgEFAA4BDQAOBwUBBQIFAwUEBQYFBwUIDgcNDQ8CAQRUZXh0AQRIZWxwAQtOYXZpZ2F0ZVVybAESaGVscC9lbi9sb2dpbi5odG1sAA8CAgAAAgEAAgIAAgMAAAANDQ8CARpBbHdheXNSZW5kZXJUZXh0RGVjb3JhdGlvbggCAAAAAAAAAA0NDwICBAAIAgAAAAAAAAANDQ8BAgAAAQR0ZXN0AAAAAA0NAAwaGA1TeXN0ZW0uU3RyaW5nTm1zY29ybGliLCBWZXJzaW9uPTEuMC41MDAwLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQ4BEkNoaW5lc2UtU2ltcGxpZmllZAETQ2hpbmVzZS1UcmFkaXRpb25hbAEFQ3plY2gBB0VuZ2xpc2gBBkZyZW5jaAEGR2VybWFuAQlIdW5nYXJpYW4BB0l0YWxpYW4BCEphcGFuZXNlAQZQb2xpc2gBEVBvcnR1Z3Vlc2UtQnJhemlsAQdSdXNzaWFuAQZTbG92YWsBB1NwYW5pc2gaGQYADgEFemgtQ04BBXpoLVRXAQJjcwECZW4BAmZyAQJkZQECaHUBAml0AQJqYQECcGwBBXB0LUJSAQJydQECc2sBAmVzDgEFAwAADQ0PAQIAAAEGTG9nIEluAA8BAgAAAiMAAAANDwECAAABFWh0dHA6Ly9sb2NhbGhvc3Q6ODA4NgAADgEBCG5vc2NyaXB0"
/>
<noscript>
<input name="noscript" id="noscript" type="hidden" value="true" />
</noscript>
<div class="loginpage" align="center">
<div class="loginbanner">
<img src="images/login_title.gif" alt=' Administrator'>
<a id="HelpButton" class="loginHelp" href="help/en/login.html"
target="Help">Help</a>
</div>
<div class="logincontent">
<table cellpadding="8px" cellspacing="0" width="100%">
<tr>
<td class="logincontentlabel">
<span id="MessageType"></span>
</td>
<td class="logincontenttext">
<span id="MessageText"></span>
</td>
</tr>
<tr>
<td class="logincontentlabel">
Username:
</td>
<td class="logincontenttext">
<input id="UserName" type="text" value="test" name="UserName" />
</td>
</tr>
<tr>
<td class="logincontentlabel">
Password:
</td>
<td class="logincontenttext">
<input id="Password" type="password" name="Password" />
</td>
</tr>
<tr>
<td class="logincontentlabel">
Language:
</td>
<td class="logincontenttext">
<select name="LanguageList" id="LanguageList">
<option value="zh-CN">Chinese-Simplified</option>
<option value="zh-TW">Chinese-Traditional</option>
<option value="cs">Czech</option>
<option selected="selected" value="en">English</option>
<option value="fr">French</option>
<option value="de">German</option>
<option value="hu">Hungarian</option>
<option value="it">Italian</option>
<option value="ja">Japanese</option>
<option value="pl">Polish</option>
<option value="pt-BR">Portuguese-Brazil</option>
<option value="ru">Russian</option>
<option value="sk">Slovak</option>
<option value="es">Spanish</option>
</select>
</td>
</tr>
<tr>
<td colspan="2" align="right" class="loginbutton">
<input type="submit" name="LoginButton" value="Log In"
id="LoginButton" class="button" />
</td>
</tr>
</table>
</div>
<div class="loginfooter">
Server:
http://localhost:8086
<br>
© Copyright 2006 , Inc. All rights reserved.
</div>
</div>
</form>
</body>
</html>
On 1/11/07, Jay Marino <[email protected]> wrote:
>
> Hello Prabudasv,
>
> Is your form setting some other parameters via scripting? Can you share
> with the list the code of the page that you are using?
>
> Cheers!
> J
>
> ----- Original Message -----
> *From:* Prabudas varadarajan <[email protected]>
> *To:* [email protected]
> *Sent:* Wednesday, January 10, 2007 3:10 AM
> *Subject:* Re: [Httpunit-develop] Not able to login
>
> 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
>
>
-------------------------------------------------------------------------
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