#!/usr/bin/perl use LWP::UserAgent; my $url = 'http://sample.com/sites/projcentral/test.xls'; my $ua = new LWP::UserAgent(keep_alive=>1); $ua->no_proxy; #$ua->agent('MSIE/6.0'); $ua->credentials('sample.com','/sites/projcentral/','mohan' => 'mohan123'); $ua->timeout(15); my $request = HTTP::Request->new('GET'); $request->url($url); my $response = $ua->request($request); my $code = $response->code; print "Return Code ====>\n $code\n"; my $headers = $response->headers_as_string; #If the Error is 401.2 then, #The authentication methods that were tried are either disabled, or you are attempting to use NTLM through a proxy server. print "Headers ======>\n $headers\n"; # HTML body: my $body = $response->content; print "================\n$body====================\n"; #### Return Code ====> 401 Headers ======> Date: Mon, 10 Nov 2008 04:53:08 GMT Server: Microsoft-IIS/6.0 WWW-Authenticate: NTLM Content-Length: 1656 Content-Type: text/html Content-Type: text/html; charset=Windows-1252 Client-Date: Mon, 10 Nov 2008 04:53:08 GMT Client-Peer: 10.24.250.27:80 Client-Response-Num: 1 Client-Warning: Unsupported authentication scheme 'ntlm' MicrosoftSharePointTeamServices: 12.0.0.6219 Set-Cookie: RBNA_Boschbiz_07=R731053916; path=/ Title: You are not authorized to view this page X-Powered-By: ASP.NET ================ 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 again with different credentials.

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


Technical Information (for support personnel)

  • Go to Microsoft Product 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.
====================