The Request Failed With HTTP Status 401: Unauthorized Using SSRS

I am an avid user of Microsoft SQL Server Reporting Services (SSRS) and have been for a while. In fact I wrote an article a while ago about using the reports through web services. This is a little different article in that I am not writing something new but addressing an issue that I came across several weeks ago after my web host provider upgraded the server to SSRS 2012. As all developers know it is fun to upgrade but can be frustrating at the same time.

After updating the server location and recreating the data source connections in SQL SSRS I was still getting the 401 error. After spending time with Arvixe and their great support staff nothing seemed to work. I knew the problem was with permissions but did not know what could have changed. Did I say that I spent many hours and many attempts to have it work? In the end I found a small change to the code that seemed to work. I am still trying to figure out why this should have made a big difference but maybe this would help someone else. Once I figure out why this needed to be changed I will post the response here. (If you know why then feel free to leave a comment.).

Prior Code: (From original blog)

[code language=”vb”]

‘This is very important. You need to pass the credentials so that Arvixe will let you login and run the report
Dim cache As CredentialCache = New CredentialCache()
‘Add a NetworkCredential instance to CredentialCache.
‘Negotiate for NTLM or Kerberos authentication.
cache.Add(New Uri(rs.Url), "Negotiate", New NetworkCredential("[ARVIXE LOGIN NAME TO REPORT SERVER", "PASSWORD TO THE REPORT SERVER", "SERVER NAME ie."))
‘Assign CredentialCache to the Web service Client Proxy(myProxy) Credetials property.
rs.Credentials = cache

New Change (for SSRS2012)

[code language=”vb”]

I do not know if my hosting provider did something different in the setup or if SSRS2012 handles credentials a little different by default but if you run into a 401 error you can make sure that this is not the cause.

Looking for quality web hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , , , , , | Posted under Programming/Coding, Using Arvixe | RSS 2.0

Author Spotlight

David Bauernschmidt

I live in the historical triangle of Virginia where I am married with two daughters. I have spent over 13 years working for a Fortune 500 company in the computer area. I started in VB 6.0 and by the time I ended my employment I was supervising a development team where we built many web applications. When my first daughter was born I wanted to spend more time with her so I left and became a programmer analyst for local government as well as launch my own company. Since then I have grown James River Webs into a profitable web design and application company helping small businesses create a big presence on the internet. As an employee I have created web application used by citizens and other companies. I enjoy fly fishing, and spending time with my family. I also enjoy learning new approaches and development tools when it comes to developing applications.

Leave a Reply

Your email address will not be published. Required fields are marked *