http://qs321.pair.com?node_id=586414

eisdrache has asked for the wisdom of the Perl Monks concerning the following question:

I have website running javaserver pages that requires authentication via a login form on the front page.

If I access the page via a web browser I can submit my info and enter the site without a problem. However, when using WWW::Mechanize with the same exact login credentials I am denied entrance.

Here is the basic site setup:
login.jsp -> search.jsp -> mainIndex.jsp

When a user logs in the request is sent from login.jsp to search.jsp where the information is examined. If successful the request is redirected to the main page and the user is logged in, otherwise the request is redirected back to login.jsp with an error message asking to login to access the main page.

Here is a section of the code I am running:
my $mech = WWW::Mechanize->new(); $mech->cookie_jar(HTTP::Cookies->new()); $mech->get($target); $mech->form_name('LoginForm'); $mech->field('loginId' => $login_id); $mech->field('password' => $password); $mech->click();
For whatever reason the search.jsp page does not like the request coming from WWW::Mechanize and I cannot figure out the problem, hence the reason for the post.

I realize this info is vague but I at least needed to create a starting point. Any help is greatly appreciated!