all groups > sql server reporting services > june 2005 >
You're in the

sql server reporting services

group:

IIS Basic authentication problem - 401 Unauthorized error


IIS Basic authentication problem - 401 Unauthorized error Bruce A
6/13/2005 2:57:03 PM
sql server reporting services:
Hello all,

I have users attempting to view reports (created in Reporting Services 2000)
over the web and they're receiving a "401 - Unauthorized" error due to
invalid credentials. Here is the VB.NET code that's being used to
authenticate the user:

Dim strURL as String =
"http://mydomain.mywebsite.com/ReportServer?MyFolder/MyReport?arg1=1&arg2=2&rs:Command=Render&rs:Format=PDF"

Dim ReportWebRequest As HttpWebRequest =
CType(WebRequest.Create(strReportURL), HttpWebRequest)

ReportWebRequest.Timeout = 1000000

ReportWebRequest.MaximumAutomaticRedirections = 50

ReportWebRequest.Headers.Add("Authorization", "Basic " +
Convert.ToBase64String(Encoding.ASCII.GetBytes("userid:password")))

ReportWebRequest.PreAuthenticate = True

Dim ReportWebResponse As HttpWebResponse =
CType(ReportWebRequest.GetResponse(), HttpWebResponse)

We would prefer not to turn on anonymous access. We are running IIS vers.6
on a Win 2003 Server. Any ideas?

Thanks in advance,
RE: IIS Basic authentication problem - 401 Unauthorized error Steve
6/15/2005 2:52:12 PM
Bruce,

Try replacing the following lines of code...


ReportWebRequest.Headers.Add("Authorization", "Basic " +
Convert.ToBase64String(Encoding.ASCII.GetBytes("userid:password")))

ReportWebRequest.PreAuthenticate = True


....with these lines:

Dim cCache = New CredentialCache

cCache.Add(New Uri(strReportURL), "Basic", New NetworkCredential("userid",
"password", "domain"))

ReportWebRequest.Credentials = cCache


Hope this helps,
Steve


[quoted text, click to view]
AddThis Social Bookmark Button