Dear perl gurus:
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';
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;
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:
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!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||