• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6095
  • Last Modified:

Reporting Services Error: System.Net.WebException: The request failed with HTTP status 401: Unauthorized.

I am migrating a visual studio 2008 web application to visual studio 2010.
This web application is using a report viewer control.
I have removed the 2008 reportviewer control and added the 2010 reportviewer control.

When i attempt to load the report inside the web page i get the following error:

[WebException: The request failed with HTTP status 401: Unauthorized.]
   Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.GetSecureMethods() +204
   Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.IsSecureMethod(String methodname) +47
   Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.SetConnectionSSLForMethod(String methodname) +12
   Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.ProxyMethodInvocation.Execute(RSExecutionConnection connection, ProxyMethod`1 initialMethod, ProxyMethod`1 retryMethod) +446
   Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.LoadReport(String Report, String HistoryID) +178
   Microsoft.Reporting.WebForms.ServerReport.EnsureExecutionSession() +79
   Microsoft.Reporting.WebForms.ServerReport.SetParameters(IEnumerable`1 parameters) +69
   extranet.printpog1.Page_Load(Object sender, EventArgs e) +401
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

Open in new window


Here is the code from my web application:

            <rsweb:ReportViewer
            CssClass="reportviewercss"
            ID="ReportViewer1" 
            runat="server" 
            Font-Names="Verdana" 
            PromptAreaCollapsed="true"   
            ShowPromptAreaButton="false"            
            Height="800px" 
            ProcessingMode="Remote"
            ExportContentDisposition="AlwaysInline" 
            Width="1025px">
                <ServerReport 
                ReportPath="/Sales/Online Ordering/Product Order Guide"  
                ReportServerUrl="http://server.domain.com/ReportServer"
                />
            </rsweb:ReportViewer>

Open in new window


I am using the same application pool identity as i did in the vs 2008 version of this web application, so i am not sure what the trouble is.

Maybe there is some trickery needed so that a vs 2010 application can communicate with a 2005 report server?

Any thoughts?
Jason
0
jsvb1977
Asked:
jsvb1977
  • 5
  • 5
1 Solution
 
lcohanDatabase AnalystCommented:
What about authentication/rights to the report folder in new page? is it the same user and are the SSRS rights granted to that NT user to run the report?
0
 
jsvb1977Author Commented:
Icohan,

Thanks for the reply. I am having trouble understanding what you mean.
Its likely my fault that I do not understand, though.

Would you mind attempting to clarify your question a little bit more for me?

Jason
0
 
lcohanDatabase AnalystCommented:
Sure, the new page you are trying to access will be executed under current NT login and does that login have sufficient rights for SSRS report to run in that page? Here's how Authentication works in Reporting Services:

http://technet.microsoft.com/en-us/library/ms152899.aspx

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
jsvb1977Author Commented:
ok, well i made an assumption that the application pool identity that is assigned to this web application is the user that will be authenticating against the report server.

If i am correct, then the answer to your question would be "yes, this user has rights to run the report."

The thing that makes me concerned is that this exact same code is running properly in the following locations:

1. IIS 7.5 on the Production Server [Web Server 2008]
2. In VS 2008 Debug on an XP Machine [IIS 6.0]

Both of the above environments use the same Applicatin Pool Identity to access the report that I am trying to embed in my VS 2010 asp.net web page.

Jason
0
 
lcohanDatabase AnalystCommented:
And more speciffic hopefully similar answer to what you are looking for:

http://stackoverflow.com/questions/2067976/using-ssrs-with-asp-net-reportviewer


Also at this link below you can see hou to use a "dummy" non Windows AD user:

http://forums.asp.net/t/1638562.aspx/1
0
 
lcohanDatabase AnalystCommented:
<<The thing that makes me concerned is that this exact same code is running properly in the following locations:

1. IIS 7.5 on the Production Server [Web Server 2008]
2. In VS 2008 Debug on an XP Machine [IIS 6.0]
.>>


Are you using the same NT login on both when you run the report? than that's your answer as the authentication between service(web site app pool) and sql db is usualy done on the backend on the same user. If you want each user to have their own page/report rights please see more below:

"It's always challenging to debug authentication issues remotely, but you might able to solve your problem by enabling impersonation on your AppPool. That way, when a user is logged-in, IIS would be able to connect to SQL Server as your user."

http://stackoverflow.com/questions/2067976/using-ssrs-with-asp-net-reportviewer
0
 
jsvb1977Author Commented:
No, I do not want each user that access the website to have their own page/report rights. I want to control the rights 'globally' -- which is what i thought i was doing with the application pool identity.

I am looking into something like this:

ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerCredentials("username", "pwd", "domain");

As per one of the links you provided.
I will keep you posted...

Jason
0
 
jsvb1977Author Commented:
So, here is what i had to do to get this report to run in my asp.net vs 2010 application:

1. I had to define the user that will access the report in the code behind [as per my post above].
2. I had to upgrade my application to .Net 3.5 and include the Script Manager from the Toolbox
3. I had to move my report to SQL Server 2008 Reporting Services [embedding ssrs 2005 reports into vs 2010 is not possible] (Confirmation on this?)
4. I had to wrap the initial PageLoad Report Routines in the code behind in a IsPostBack

Thank you for the resources to help me get this done.
Jason
0
 
jsvb1977Author Commented:
Here is the direct link to the page that i used to build the class that i call to authenticate against the report server:

http://social.msdn.microsoft.com/forums/en-US/vsreportcontrols/thread/c65abca7-0fdb-40fb-aabe-718f63377a55/

ASP.Net SSRS Authentication Class

Jason
0
 
lcohanDatabase AnalystCommented:
Honestly I never tried that as we migrated(upgraded) all the reports from 2005 to 2008 before using them in VS2008 and/or 2010.
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now