Login issues with my script.

------=_NextPart_000_0164_01CBB81B.680AFF10
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi all.

I am having a bad week. things are not working as they should. Grin. Fix =
one problem ane another pops up.

I have been successful in logging into other sites using the identity =
method when a loging pop-up appears. But as yet, I have not been =
successful in using a loging form that is built into the web page. I =
believe I am doing this correct.

the purpose of the script is to check for new books and eventually to do =
searches. Also to learn PWL.

When I use the post approach, I receive the below from the request =
headers:

loging: 1
trying to log in
response: 302 Found
headers: Cache-Control: private
Date: Wed, 19 Jan 2011 04:39:17 GMT
Location: https://www.x.net/signin.aspx?
Server: Microsoft-IIS/6.0
Content-Length: 158
Content-Type: text/html; charset=3Dutf-8
Client-Date: Wed, 19 Jan 2011 04:39:17 GMT
Client-Peer: 2.4.3.2:80
Client-Response-Num: 1
Set-Cookie: ASP.NET_SessionId=3D414y4avh4fon1c451juvates; path=3D/; =
HttpOnly
Set-Cookie: SkinID=3D1; domain=3Dx.net; expires=3DThu, 19-Jan-2012 =
04:39:17 GMT; path=3D/
Title: Object moved
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET

I have removed the actual correct ip addresses and web site for privacy =
reasons. the code I am using to log in is:

use strict;
use constant DEBUG =3D> 0;
use warnings;
use LWP::UserAgent;
use HTML::TokeParser;
use URI;
use HTML::TreeBuilder 3;

my $web_page =3D 'http://www.x.net/c-60-my-books.aspx';
my $login_page =3D 'http://www.x.net/signin.aspx';

my $browser =3D LWP::UserAgent->new( );
# Simulation of browser tag.
#$browser->agent("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; =
rv:1.9.0.5; .NET CLR 2.0.50727; ffco7) Gecko/2008120122 Firefox/3.0.5");

# create an empty cooky jar.
$browser->cookie_jar( {} );
my $username_label =3D "EMail"; # email label.
my $password_label =3D "txtPassword";
my $user_id =3D 'name';
my $password =3D 'x';

my $response; # stores the response object.

print "trying to log in\n";
$response =3D $browser->post(
$login_page,
[
$username_label =3D> $user_id,
$password_label =3D> $password,
'LoginButton' =3D> 'Login'
]);

my $text =3D $response->status_line( );
print "response: $text \n";
my $headers =3D $response->headers_as_string( );
print "headers: $headers\n";
my $content =3D $response->content( );


Any clues on what is not working, would be welcomed. is it possible to =
login via the:

$browser->identity ( )

approach?

Sean
------=_NextPart_000_0164_01CBB81B.680AFF10--
Sean Murphy [ Mi, 19 Januar 2011 10:56 ] [ ID #2053491 ]

Re: Login issues with my script.

On 19/01/2011 09:56, Sean Murphy wrote:
> Hi all.
>
> I am having a bad week. things are not working as they should. Grin.
> Fix one problem ane another pops up.
>
> I have been successful in logging into other sites using the
> identity method when a loging pop-up appears. But as yet, I have not
> been successful in using a loging form that is built into the web
> page. I believe I am doing this correct. >
> the purpose of the script is to check for new books and eventually
> to do searches. Also to learn PWL.
>
> When I use the post approach, I receive the below from the request
> headers:
>
> loging: 1
> trying to log in
> response: 302 Found
> headers: Cache-Control: private
> Date: Wed, 19 Jan 2011 04:39:17 GMT
> Location: https://www.x.net/signin.aspx?
> Server: Microsoft-IIS/6.0
> Content-Length: 158
> Content-Type: text/html; charset=utf-8
> Client-Date: Wed, 19 Jan 2011 04:39:17 GMT
> Client-Peer: 2.4.3.2:80
> Client-Response-Num: 1
> Set-Cookie: ASP.NET_SessionId=414y4avh4fon1c451juvates; path=/; HttpOnly
> Set-Cookie: SkinID=1; domain=x.net; expires=Thu, 19-Jan-2012 04:39:17 GMT; path=/
> Title: Object moved
> X-AspNet-Version: 2.0.50727
> X-Powered-By: ASP.NET
>
> I have removed the actual correct ip addresses and web site for
> privacy reasons. the code I am using to log in is:
>
> use strict;
> use constant DEBUG => 0;
> use warnings;
> use LWP::UserAgent;
> use HTML::TokeParser;
> use URI;
> use HTML::TreeBuilder 3;
>
> my $web_page = 'http://www.x.net/c-60-my-books.aspx';
> my $login_page = 'http://www.x.net/signin.aspx';
>
> my $browser = LWP::UserAgent->new( );
> # Simulation of browser tag.
> #$browser->agent("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.5; .NET CLR 2.0.50727; ffco7) Gecko/2008120122 Firefox/3.0.5");
>
> # create an empty cooky jar.
> $browser->cookie_jar( {} );
> my $username_label = "EMail"; # email label.
> my $password_label = "txtPassword";
> my $user_id = 'name';
> my $password = 'x';
>
> my $response; # stores the response object.
>
> print "trying to log in\n";
> $response = $browser->post(
> $login_page,
> [
> $username_label => $user_id,
> $password_label => $password,
> 'LoginButton' => 'Login'
> ]);
>
> my $text = $response->status_line( );
> print "response: $text \n";
> my $headers = $response->headers_as_string( );
> print "headers: $headers\n";
> my $content = $response->content( );
>
>
> Any clues on what is not working, would be welcomed. is it possible to login via the:
>
> $browser->identity ( )
>
> approach?

Hi Sean

If you look at the site's login page, you will see that
http://www.x.net/signin.aspx is redirected to a secure HTTPS page before
it accepts input. To handle this you will need Crypt::SSLeay installed
and used in your program.

Also there is a total of eight input fields to the form, and while you
may get away with leaving out some of them there are two hidden fields -
__VIEWSTATE and __EVENTVALIDATION - which are almost certainly necessary
to get past the login security that the site imposes. This is much more
easily handled using HTML::Form to copy the values of these hidden
fields to the login request.

HTH,

Rob

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Rob Dixon [ Mi, 19 Januar 2011 12:55 ] [ ID #2053493 ]

Re: Login issues with my script.

On Jan 19, 7:55=A0pm, rob.di... [at] gmx.com (Rob Dixon) wrote:
> On 19/01/2011 09:56, Sean Murphy wrote:
>
>
>
> > Hi all.
>
> > I am having a bad week. things are not working as they should. Grin.
> > Fix one problem ane another pops up.
>
> > I have been successful in logging into other sites using the
> > identity method when a loging pop-up appears. But as yet, I have not
> > been successful in using a loging form that is built into the web
> > page. I believe I am doing this correct. >
> > the purpose of the script is to check for new books and eventually
> > to do searches. Also to learn PWL.
>
> > When I use the post approach, I receive the below from the request
> > headers:
>
> > loging: 1
> > trying to log in
> > response: 302 Found
> > headers: Cache-Control: private
> > Date: Wed, 19 Jan 2011 04:39:17 GMT
> > Location:https://www.x.net/signin.aspx?
> > Server: Microsoft-IIS/6.0
> > Content-Length: 158
> > Content-Type: text/html; charset=3Dutf-8
> > Client-Date: Wed, 19 Jan 2011 04:39:17 GMT
> > Client-Peer: 2.4.3.2:80
> > Client-Response-Num: 1
> > Set-Cookie: ASP.NET_SessionId=3D414y4avh4fon1c451juvates; path=3D/; Htt=
pOnly
> > Set-Cookie: SkinID=3D1; domain=3Dx.net; expires=3DThu, 19-Jan-2012 04:3=
9:17 GMT; path=3D/
> > Title: Object moved
> > X-AspNet-Version: 2.0.50727
> > X-Powered-By: ASP.NET
>
> > I have removed the actual correct ip addresses and web site for
> > privacy reasons. the code I am using to log in is:
>
> > use strict;
> > use constant DEBUG =3D> =A00;
> > use warnings;
> > use LWP::UserAgent;
> > use HTML::TokeParser;
> > use URI;
> > use HTML::TreeBuilder 3;
>
> > =A0 my $web_page =3D 'http://www.x.net/c-60-my-books.aspx';
> > my $login_page =3D 'http://www.x.net/signin.aspx';
>
> > =A0 my $browser =3D LWP::UserAgent->new( =A0);
> > # Simulation of browser tag.
> > #$browser->agent("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.=
9.0.5; .NET CLR 2.0.50727; ffco7) Gecko/2008120122 Firefox/3.0.5");
>
> > # create an empty cooky jar.
> > $browser->cookie_jar( {} );
> > =A0 my $username_label =3D "EMail"; # email label.
> > =A0 my $password_label =3D "txtPassword";
> > =A0 my $user_id =3D 'name';
> > =A0 my $password =3D 'x';
>
> > my $response; # stores the response object.
>
> > print "trying to log in\n";
> > $response =3D $browser->post(
> > =A0 $login_page,
> > =A0 [
> > =A0 $username_label =3D> =A0$user_id,
> > =A0 $password_label =3D> =A0$password,
> > =A0 'LoginButton' =3D> =A0'Login'
> > =A0 ]);
>
> > my $text =3D $response->status_line( );
> > print "response: $text \n";
> > my $headers =3D $response->headers_as_string( );
> > print "headers: $headers\n";
> > my $content =3D $response->content( =A0);
>
> > Any clues on what is not working, would be welcomed. is it possible to =
login via the:
>
> > $browser->identity ( )
>
> > approach?
>
> Hi Sean
>
> If you look at the site's login page, you will see thathttp://www.x.net/s=
ignin.aspxis redirected to a secure HTTPS page before
> it accepts input. To handle this you will need Crypt::SSLeay installed
> and used in your program.
>
> Also there is a total of eight input fields to the form, and while you
> may get away with leaving out some of them there are two hidden fields -
> __VIEWSTATE and __EVENTVALIDATION - which are almost certainly necessary
> to get past the login security that the site imposes. This is much more
> easily handled using HTML::Form to copy the values of these hidden
> fields to the login request.
>
> HTH,
>
> Rob

This helped a lot.....!!!
Was missing the __EVENTVALIDATION from the form....!!!


--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
stavan [ Mo, 07 Februar 2011 08:03 ] [ ID #2054721 ]

Re: Login issues with my script.

--20cf3056442d5c14b6049bacc728
Content-Type: text/plain; charset=ISO-8859-1

On Feb 7, 2011 2:57 AM, "stavan" <stavan2003 [at] gmail.com> wrote:
>
> On Jan 19, 7:55 pm, rob.di... [at] gmx.com (Rob Dixon) wrote:
> > On 19/01/2011 09:56, Sean Murphy wrote:
> >
> >
> >
> > > Hi all.
> >
> > > I am having a bad week. things are not working as they should. Grin.
> > > Fix one problem ane another pops up.
> >
> > > I have been successful in logging into other sites using the
> > > identity method when a loging pop-up appears. But as yet, I have not
> > > been successful in using a loging form that is built into the web
> > > page. I believe I am doing this correct. >
> > > the purpose of the script is to check for new books and eventually
> > > to do searches. Also to learn PWL.
> >
> > > When I use the post approach, I receive the below from the request
> > > headers:
> >
> > > loging: 1
> > > trying to log in
> > > response: 302 Found
> > > headers: Cache-Control: private
> > > Date: Wed, 19 Jan 2011 04:39:17 GMT
> > > Location:https://www.x.net/signin.aspx?
> > > Server: Microsoft-IIS/6.0
> > > Content-Length: 158
> > > Content-Type: text/html; charset=utf-8
> > > Client-Date: Wed, 19 Jan 2011 04:39:17 GMT
> > > Client-Peer: 2.4.3.2:80
> > > Client-Response-Num: 1
> > > Set-Cookie: ASP.NET_SessionId=414y4avh4fon1c451juvates; path=/;
HttpOnly
> > > Set-Cookie: SkinID=1; domain=x.net; expires=Thu, 19-Jan-2012 04:39:17
GMT; path=/
> > > Title: Object moved
> > > X-AspNet-Version: 2.0.50727
> > > X-Powered-By: ASP.NET
> >
> > > I have removed the actual correct ip addresses and web site for
> > > privacy reasons. the code I am using to log in is:
> >
> > > use strict;
> > > use constant DEBUG => 0;
> > > use warnings;
> > > use LWP::UserAgent;
> > > use HTML::TokeParser;
> > > use URI;
> > > use HTML::TreeBuilder 3;
> >
> > > my $web_page = 'http://www.x.net/c-60-my-books.aspx';
> > > my $login_page = 'http://www.x.net/signin.aspx';
> >
> > > my $browser = LWP::UserAgent->new( );
> > > # Simulation of browser tag.
> > > #$browser->agent("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB;
rv:1.9.0.5; .NET CLR 2.0.50727; ffco7) Gecko/2008120122 Firefox/3.0.5");
> >
> > > # create an empty cooky jar.
> > > $browser->cookie_jar( {} );
> > > my $username_label = "EMail"; # email label.
> > > my $password_label = "txtPassword";
> > > my $user_id = 'name';
> > > my $password = 'x';
> >
> > > my $response; # stores the response object.
> >
> > > print "trying to log in\n";
> > > $response = $browser->post(
> > > $login_page,
> > > [
> > > $username_label => $user_id,
> > > $password_label => $password,
> > > 'LoginButton' => 'Login'
> > > ]);
> >
> > > my $text = $response->status_line( );
> > > print "response: $text \n";
> > > my $headers = $response->headers_as_string( );
> > > print "headers: $headers\n";
> > > my $content = $response->content( );
> >
> > > Any clues on what is not working, would be welcomed. is it possible to
login via the:
> >
> > > $browser->identity ( )
> >
> > > approach?
> >
> > Hi Sean
> >
> > If you look at the site's login page, you will see thathttp://
www.x.net/signin.aspxis redirected to a secure HTTPS page before
> > it accepts input. To handle this you will need Crypt::SSLeay installed
> > and used in your program.
> >
> > Also there is a total of eight input fields to the form, and while you
> > may get away with leaving out some of them there are two hidden fields -
> > __VIEWSTATE and __EVENTVALIDATION - which are almost certainly necessary
> > to get past the login security that the site imposes. This is much more
> > easily handled using HTML::Form to copy the values of these hidden
> > fields to the login request.
> >
> > HTH,
> >
> > Rob
>
> This helped a lot.....!!!
> Was missing the __EVENTVALIDATION from the form....!!!
>

IIRC, those fields are asp's way of managing sessions without a cookie.
Never programmed .net, however I would think that if someone accessed a
method to create them and they aren't returned, something's going to break.

--20cf3056442d5c14b6049bacc728--
Shawn Wilson [ Mo, 07 Februar 2011 09:11 ] [ ID #2054722 ]
Perl » gmane.comp.lang.perl.beginners » Login issues with my script.

Vorheriges Thema: Text Manipulation
Nächstes Thema: cgi or new stuff?