Puma_perl has asked for the wisdom of the Perl Monks concerning the following question:
I am humbly asking you for your assistance. I was trying to use LWP::UserAgent to go to a password protected ASP page (my login/password works fine with IE browser). The code I have written is like this:
my $h = new HTTP::Headers Content_Base => '$url'; $h->authorization_basic($uname, $password); my $request = HTTP::Request->new( 'GET', $url, $h ) ; my $ua = LWP::UserAgent->new; my $response = $ua->request($request); ### get content of this HTML $content = $response->content; #print $content;
These lines work well with other web pages written in CGI but it did not work for a link written in ASP. Here is the error I got from the run:
"HTTP 401.2 - Unauthorized: Logon failed due to server configuration Internet Information Services".
The returned HTML also suggested:
"This is usually caused by a server-side script not sending the proper WWW-Authenticate header field. Using Active Server Pages scripting this is done by using the AddHeader method of the Response object to request that the client use a certain authentication method to access the resource."
So, it hinted that something might need to be done on the server side. However, since I don't have control/contract from the server hosting this link, is there any ways that I can solve this problem from my end? Any suggestions or tips will be highly appreciated!