Wednesday, March 28, 2012

ReportViewer control

trying to build a test page with a single ReportViewer control



<rsweb:ReportViewer ID="ReportViewer1" ProcessingMode="remote" runat="server">

<ServerReport DisplayName="VSTestReport" ReportPath="MyReports/VSTestReport" ReportServerUrl="http://pugrs/reportserver"/>

</rsweb:ReportViewer>


build fails with 401: Unauthorized.
Not even sure where to begin troubleshooting this one. Any ideas?
Thanks!

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.WebException: The request failed with HTTP status 401: Unauthorized.

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[WebException: The request failed with HTTP status 401: Unauthorized.]
Microsoft.SqlServer.ReportingServices2005.Execution.RSExecutionConnection.GetSecureMethods() +240
Microsoft.SqlServer.ReportingServices2005.Execution.RSExecutionConnection.IsSecureMethod(String methodname) +86
Microsoft.SqlServer.ReportingServices2005.Execution.RSExecutionConnection.SetConnectionSSLForMethod(String methodname) +33
Microsoft.SqlServer.ReportingServices2005.Execution.RSExecutionConnection.LoadReport(String Report, String HistoryID) +152
Microsoft.Reporting.WebForms.ServerReport.GetExecutionInfo() +249
Microsoft.Reporting.WebForms.ServerReport.GetParameters() +40
Microsoft.Reporting.WebForms.ParametersArea.GetMetaDataFromReport(Boolean useCurrentValues) +138
Microsoft.Reporting.WebForms.ReportViewer.OnPreRender(EventArgs e) +182
System.Web.UI.Control.PreRenderRecursiveInternal() +77
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1787
ok. got past the authentication problem... got a new one now:

The path of the item "MyReports/VSTestReport" is not valid. The path must be less than 260 characters long and must not start with slash. Other restrictions apply. > The path of the item "MyReports/VSTestReport" is not valid. The path must be less than 260 characters long and must not start with slash. Other restrictions apply.
|||

I believe the problem is in the placement of your "/"

When naming the the server is should look like "http://localhost/reportserver"
then when naming the report path it would be "/MyReports/VSTestReport"

Good Luck
-JW

|||Hi PugV,

Got the same problem as you had with the authentication. It was probably pretty easy to solve but I'm a newbie so I'm glad for any help. What did you do to make it work? I have no clue where to begin searching for this one.

Thanks for your answer in advance.

Nat|||Thanks JW. -- adding a slash did work

the error message that says: The path must not start with slash, should probably be a bit more helpful ;)

|||

Nat.
We were playing with some domain accounts at the time, and the problem went away once we stopped. I have to assume that error had something to do with that -- I didn't do anything specific to resolve it.

|||Pugv,

I surely need your help TOO. I met the same "unauthorized" error. I cannot use this kind of url:
server: "http://localhost/reportserver"
report path:"/MyReports/VSTestReport"
because it will show 404 Not found error. I used:
server: "http://localhost/reportserver?"
report path:"/MyReports/VSTestReport"
and got the "unauthorized" error. Which version of visual studio are you using? I'm using 2005 beta 2.

I have tried different settings for the reportserver, even implemented IReportServerCredentials, but no luck at all. There is absolutely NO problem when I connect directly to http://localhost/reportserver?/MyReports/VSTestReport

using browser. But when using reportviewer, always "unauthorized". I'm crazy with it now. Can you post your exact codes so that I can try on my machine? Thanks.|||

Camms
I had the same trouble you did. This is what I did to make it work.

reportViewer1.ServerReport.ReportServerUrl = new System.Uri("http://localhost/reportserver");
reportViewer1.ServerReport.ReportPath = reportPath;
reportViewer1.RefreshReport();

-JW

|||could you tell me how you solved authentication problem?|||

i have the authentication problem too...

|||

I got it running by Just putting following

<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt"

Height="400px"ProcessingMode="Remote"Width="400px">

<ServerReportReportPath="/WebReport/warmup"

ReportServerUrl="http://localhost/reportserver"/>

</rsweb:ReportViewer>

|||I think that as long you are doing it on localhost, it will work.

I am using a web app on another iss than the on hosting the sql2005.

I have to pass some authentication, but I need a step by step code example. Can anybody please please help?|||

I have the same problem

IIS / ASP.net on Server1, SQL Server 2005 Standard and Reporting Services on Server2

My web app uses forms authentication with the ASP.net SqlAuthenticationProvider. So my users are stored in a table in Sql Server 2005

How do I have to pass a authentication if I like to use the ReportViewer Control in my Website?

Thanks,

Dirk

|||

I am having the same problem, my Reporting Services is also in a different server.

Currently, if I open the the reporting services using a web browser it prompts for a windows login, which I think I need to pass the same information using a ReportViewer control inside a code.

Example:

ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
// Get the Report Server endpoint from the config file
ReportViewer1.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["ReportServerEndPoint"]);
ReportViewer1.ServerReport.ReportPath = "DailyCensus";

// Need to a code to pass the windows authentication....
//ReportViewer1.ServerReport.ReportServerCredentials

|||Anyone solved the problem with "401: Unauthorized" when viewing the reportViewer if WebServer and SSRS are in 2 servers?

No comments:

Post a Comment