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!
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link
or How to display code and escape characters
are good places to start.