Link to home
Start Free TrialLog in
Avatar of jsvb1977
jsvb1977

asked on

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
Avatar of lcohan
lcohan
Flag of Canada image

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?
Avatar of jsvb1977
jsvb1977

ASKER

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
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

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
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
ASKER CERTIFIED SOLUTION
Avatar of lcohan
lcohan
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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
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
Honestly I never tried that as we migrated(upgraded) all the reports from 2005 to 2008 before using them in VS2008 and/or 2010.