use HTTP::Request::Common; use Data::Dumper; use WWW::Mechanize; use MIME::Base64; my $url = 'http://test.test.com/webservices/test.asmx?; my $Domain = 'test'; my $UserName = 'test\\user'; my $Password = "pass"; my $agent = WWW::Mechanize->new(); my @args = ( Authorization => "Basic " . MIME::Base64::encode( $UserName . ':' . $Password ) ); $agent->credentials( 'http://test.test.com' , $Domain, $UserName, $Password ); my $results = $agent->get( $url, @args ); print Dumper($results); #### $VAR1 = bless( { '_protocol' => 'HTTP/1.1', '_content' => ' You are not authorized to view this page

You are not authorized to view this page

You do not have permission to view this directory or page using the credentials that you supplied because your Web browser is sending a WWW-Authenticate header field that the Web server is not configured to accept.

Please try the following:

  • Contact the Web site administrator if you believe you should be able to view this directory or page.
  • Click the Refresh button to try a gain with different credentials.

HTTP Error 401.2 - Unauthorized: Access is denied due to server configuratio n.
Internet Information Services (IIS)


Technical Information (for support personnel)

  • Go to Microsoft Produc t Support Services and perform a title search for the words HTTP and 401.
  • Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for topics titled About Security, Authentication, and About Custom Error Messages.
', '_rc' => 401, '_headers' => bless( { 'x-powered-by' => 'ASP.NET', 'client-response-num' => 1, 'date' => 'Sat, 18 Oct 2008 03:02:01 GMT ', 'client-peer' => '172.xx.xx.xx:80', 'content-length' => '1656', 'client-warning' => 'Unsupported authent ication scheme \'ntlm\'', 'client-date' => 'Sat, 18 Oct 2008 03:02 :02 GMT', 'content-type' => [ 'text/html', 'text/html; charset= Windows-1252' ], 'www-authenticate' => [ 'Negotiate', 'NTLM' ], 'server' => 'Microsoft-IIS/6.0', 'title' => 'You are not authorized to vi ew this page' }, 'HTTP::Headers' ), '_msg' => 'Unauthorized', '_request' => bless( { '_content' => '', '_uri' => bless( do{\(my $o = 'http://test.test.com/webservices/test.asmx?')}, 'URI::http' ), '_headers' => bless( { 'user-agent' => ' WWW-Mechanize/1.3401', 'accept-encoding' => 'gzip', 'authorization' = > 'Basic YmNic2ZsXHN2Yy1pc2R3ZXNwOlI4bjJCMnRjaA== ' }, 'HTTP::Headers' ), '_method' => 'GET' }, 'HTTP::Request' ) }, 'HTTP::Response' ); C:\>